Rewriting a URL that does not point to a file

D

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
 
J

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
 
D

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
 
J

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
 

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

url rewriting 3
URL Rewriting - File Access 0
Url Rewriting with Forms Authentication 0
URL rewriting 3
URL Rewriting and sub folders 0
URL rewriting 2
url rewriting 3
URL Rewriting using IHttpHandlerFactory 0

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top