|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Rewriting a URL that does not point to a fileHi,
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 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. -- Show quoteHide quoteRegards John Timney ASP.NET MVP Microsoft Regional Director "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 > 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 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). -- Show quoteHide quoteRegards John Timney ASP.NET MVP Microsoft Regional Director "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 >
Other interesting topics
ASP.NET 2.0 Themes are not WYSIWYG
Exceptions kill Sessions? Javascript two fields merged to one hidden field total newbie question about Listbox.selectedindex Print Page Role based security ImageMap Coordinate Question Scalable web architecture with ASP.NET 2.0 asp treeview Publish website problem in ASP.NET 2.0 / VS 2005 |
|||||||||||||||||||||||