Last post Feb 14, 2007 09:30 AM by ShailAtlas
Feb 07, 2007 02:40 AM|thanhh83|LINK
I want change extend on Asp.net page is ".aspx" to extend ".html" using HttpHandlers
Anyone, Help me please!
Feb 07, 2007 02:55 AM|haidar_bilal|LINK
Your question is not clear! I can help you with HttpHandlers, but state clearly what you want to do? extend ".aspx" to ".html"? what does that mean?
Feb 07, 2007 04:16 AM|thanhh83|LINK
My page: http://www.example.com/NewsDetails.aspx?NewsID=1000
I has been handler it to http://www.example.com/ShowNews/1000/test-the-news.aspx
now i want hander to http://www.example.com/ShowNews/1000/test-the-news.html
Can you help me?
Feb 07, 2007 06:22 AM|haidar_bilal|LINK
This is called URL Rewriting! Check out this document if you are using ASP.NET 1.1:
URL Rewriting in ASP.NET
Hope this helps,
Feb 08, 2007 04:38 AM|Zhao Ji Ma - MSFT|LINK
Alternatively, you can map .html and .htm extensions to Asp.net page handler, then all of the static html & htm page will handled by Asp.net.
You need to configure your extension both in IIS & Asp.net configuration file.
Feb 09, 2007 01:59 AM|thanhh83|LINK
Thank you reply.
Can you give me a demo of that?
Feb 09, 2007 06:32 AM|Zhao Ji Ma - MSFT|LINK
First, in IIS Manager, go to web site
Properties, Home Directory, Configuration...,
Map .htm extenstion to C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll, (here I'm using asp.net 1.1)
Second, add httphandler in your web.config like this:
<add path="*.htm" verb="*" type="System.Web.UI.PageHandlerFactory"
Third, create a sample .htm, e.g. sample.htm under your web application.
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<form id="form1" runat="server">
<% Response.Write("hello world"); %>
You can find it is actually parsed by asp.net.
Feb 09, 2007 11:41 PM|thanhh83|LINK
Feb 10, 2007 01:54 AM|ShailAtlas|LINK
I am doing same. its a URL rewriting.
I am redirecting that to
Page is working fine but images are not coming there as, I am setting image source in page as "~/image/picture.jpg" . this intsructs IIS to pick the picture from site root.
but when page is rendered the image src becomes "/product/1234/~/image/picture.jpg".
even when I a, keeping the image folder at the same level of page and set image src to "image/picture.jpg", it is finally rendering as "/product/1234/image/picture.jpg".
What is I am missing there
Feb 14, 2007 09:30 AM|ShailAtlas|LINK
The problem solved. I just need to add runat="server" attribute to all my images and it worked for me.
adding runat="server" is an overhead for my server ??