URL rewriting - DOTNET
This is a discussion on URL rewriting - DOTNET ; 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 ...
-
URL rewriting
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
-
Re: URL rewriting
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...
--
Patrice
-
Re: URL rewriting
Hi,
Thanks for your reply.
..* extension is work in IIS 6 but not IIS 5
so how to handle with this?
thanks
Hemant.
"Patrice" <http://scribe-en.blogspot.com/> wrote in message
news:%23hl$0dvMKHA.3284atTK2MSFTNGP06dotphx.gbl...
> 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...
>
> --
> Patrice
>
>
>
-
Re: URL rewriting
And just .html doesn't work ? Unfortunately it's quite a long time I'm awa
from IIS 5 boxes ;-)
--
Patrice
-
Re: URL rewriting
Hemant wrote:
> 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
By default, dots are not allowed in paths in IIS6 (and later versions, I
expect) as in "abc.com".
You may find the error listed in a log file in IIS's HTTPERR directory.
Andrew
-
Re: URL rewriting
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
"Andrew Morton" <akmatin-pressdotco.uk.invalid> wrote in message
news:7h6hifF2n7hhcU1atmiddotindividual.net...
> Hemant wrote:
>> 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
>
> By default, dots are not allowed in paths in IIS6 (and later versions, I
> expect) as in "abc.com".
>
> You may find the error listed in a log file in IIS's HTTPERR directory.
>
> Andrew
>
-
Re: URL rewriting
> 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-se...curity_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