URL rewriting

  • Thread starter Thread starter Hemant
  • Start date Start date
H

Hemant

Hi All,

I am using global.asax for rewriting the url.
In Application_BeginRequest I do the following.
Dim fullOrigionalpath As String =
Request.AppRelativeCurrentExecutionFilePath.ToUpper().Replace("~/",
"").ToLower()

if (fullOrigionalpath.Contains("fruit.html")) Then

Context.RewritePath("Product.aspx?RootCategoryID=1004", False)

end if

It is working fine if I run the code without the IIS .

for example: http://localhost:3905/abc.com/fruit.html

but if I run this from IIS I got error .

for example : http://localhost/abc.com/fruit.html

in this i Got 404 error .

What is the reason

What am I missing ?

Please help me.

Thanks,

Hemant
 
With IIS6, by default HTML pages are not processed by ASP.NET.

See http://msdn.microsoft.com/en-us/library/ms972974.aspx and in particular
"What Happens When a Request Reaches IIS". You'll have to map the .html
extension to the aspnet_isapi.dll...

You could perhaps see if you could avoit any extension especially if you
feel that fruit/orange or fruit/apple could be used one day...
 
Hi,
Thanks for your reply.
..* extension is work in IIS 6 but not IIS 5
so how to handle with this?
thanks
Hemant.
 
And just .html doesn't work ? Unfortunately it's quite a long time I'm awa
from IIS 5 boxes ;-)
 
Hi,
Thanks for your reply.
I am using IIS 5.1 at my machine but at the production this is IIS 6.0.
I have done url mapping on my machine and it working fine but as i deployed
it on production I got error.
error 1: Once i click on https: page than https : remain for all the pages
error 2: Image's path are wrong.
error 3: it is adding extra path to url
as http://abc.com/Test/apples.html it this link you can see Test is added
extra but at my local machine it is like
http://abc.com/apples.html
so please help me.
thanks,
hemant
 
I am using IIS 5.1 at my machine but at the production this is IIS 6.0.
I have done url mapping on my machine and it working fine but as i
deployed it on production I got error.
error 1: Once i click on https: page than https : remain for all the pages

There is something at
http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx

which might be relevant to your changing between https and http.

There's info at
http://msdn.microsoft.com/en-us/library/ms972974.aspx

which might help you. I've used ISAPI Rewrite in the past. The cost of it
might be less than you trying to implement that functionality. (Disclaimer:
I have no connection with that product other than as a user.)

HTH,

Andrew
 
Back
Top