URL rewriting

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
 
P

Patrice

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...
 
H

Hemant

Hi,
Thanks for your reply.
..* extension is work in IIS 6 but not IIS 5
so how to handle with this?
thanks
Hemant.
 
P

Patrice

And just .html doesn't work ? Unfortunately it's quite a long time I'm awa
from IIS 5 boxes ;-)
 
H

Hemant

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
 
A

Andrew Morton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

switching between https and http 0
URL rewriting 2
rewriting URL 8
URL Rewriting - File Access 0
run website with localhost 8
Regular Expression Help (URL Rewriting) 2
asp.net url rewriting 4
url rewriting 3

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top