Home All Groups Group Topic Archive Search About

Rewriting a URL that does not point to a file

Author
12 Dec 2005 8:57 AM
DC
Hi,

I need something that rewrites a URL like

myserver.com/parm1/val1/parm2/val2

to

myserver.com/default.aspx?parm1=val1&parm2=val2

Tha typical Module seems to be capable of rewriting paths that point to
a file only. TIA for any ideas.

Regards

DC

Author
12 Dec 2005 11:44 AM
John Timney ( MVP )
This is a valid URL path myserver.com/parm1/val1/parm2/val2. Its not
parameters on the URL line. So how would IIS know to pass the address
request to the ISAPI that handles asp.net reuqests so that you could convert
the path to: myserver.com/default.aspx?parm1=val1&parm2=val2

You would probably need to make the web server root the only application on
the server and any request for any resource mapped via IIS to asp.net, then
that will allow you to intercept and disseminate any URL request to the web
application myserver.com.  You could map *.* to an ihttpmodule that looked
at the path, determined if it had an extension and then reworked the new
destination path.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

Show quoteHide quote
"DC" <d*@upsize.de> wrote in message
news:1134377866.525027.261700@f14g2000cwb.googlegroups.com...
> Hi,
>
> I need something that rewrites a URL like
>
> myserver.com/parm1/val1/parm2/val2
>
> to
>
> myserver.com/default.aspx?parm1=val1&parm2=val2
>
> Tha typical Module seems to be capable of rewriting paths that point to
> a file only. TIA for any ideas.
>
> Regards
>
> DC
>
Are all your drivers up to date? click for free checkup

Author
12 Dec 2005 1:15 PM
DC
Thanks John. I am currently trying to archive my aim by customizing a
404 page. Since the request to

myserver.com/parm1/val1/parm2/val2

will end up as a 404 page, I can examine the Request.RawUrl on my
custom notfound.aspx and redirect to

myserver.com/default.aspx?parm1=val1&parm2=val2

from there. Any opinions about this approach?

Regards
DC
Author
12 Dec 2005 1:25 PM
John Timney ( MVP )
If it works for you and can scale then use it.  Its probably easier than
writing an iHTTPModule, although doing a redirect incurs a second trip to
client and back to the server again.  Server transfer would be better, and
the URL then would not be visible (if thats a good thing).

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

Show quoteHide quote
"DC" <d*@upsize.de> wrote in message
news:1134393359.579664.185300@f14g2000cwb.googlegroups.com...
> Thanks John. I am currently trying to archive my aim by customizing a
> 404 page. Since the request to
>
> myserver.com/parm1/val1/parm2/val2
>
> will end up as a 404 page, I can examine the Request.RawUrl on my
> custom notfound.aspx and redirect to
>
> myserver.com/default.aspx?parm1=val1&parm2=val2
>
> from there. Any opinions about this approach?
>
> Regards
> DC
>

Bookmark and Share