Have Asp.Net handle requests for directories
am 01.07.2007 01:31:01 von Klaus Jensen
Hi
I created code to allow me to rewrite urls from global.asax, so that if the
incoming Url is for instance:
/Hats/ReallyCoolHat.aspx
....I look up ReallyCoolHat in the products table and rewrite the url to
Product.aspx?id=12 if that is the productId for ReallyCoolHat.
This works, because .aspx-files are handled by Asp.Net, so I can catch
requests in global.asax and rewrite the url, if I want to.
I also know how to set IIS to have Asp.Net handle all kinds of extensions...
But... I also need to do something similar for folders, ie...:
/Hats/
....But this does not have an file-extension, and is not handled by Asp.Net.
How do I make Asp.Net handle this, so I can catch requests to /Hats/ in
global.asax Application_beginrequest?
Thanks in advance
Klaus
Re: Have Asp.Net handle requests for directories
am 01.07.2007 03:56:48 von David Wang
On Jun 30, 4:31 pm, "Klaus Jensen" wrote:
> Hi
>
> I created code to allow me to rewrite urls from global.asax, so that if the
> incoming Url is for instance:
>
> /Hats/ReallyCoolHat.aspx
>
> ...I look up ReallyCoolHat in the products table and rewrite the url to
> Product.aspx?id=12 if that is the productId for ReallyCoolHat.
>
> This works, because .aspx-files are handled by Asp.Net, so I can catch
> requests in global.asax and rewrite the url, if I want to.
>
> I also know how to set IIS to have Asp.Net handle all kinds of extensions...
>
> But... I also need to do something similar for folders, ie...:
>
> /Hats/
>
> ...But this does not have an file-extension, and is not handled by Asp.Net.
>
> How do I make Asp.Net handle this, so I can catch requests to /Hats/ in
> global.asax Application_beginrequest?
>
> Thanks in advance
>
> Klaus
Wildcard Application Mapping in IIS, and httpModule in ASP.Net.
http://blogs.msdn.com/david.wang/archive/2005/10/14/HOWTO-II S-6-Request-Processing-Basics-Part-1.aspx
http://blogs.msdn.com/david.wang/archive/2005/10/15/Why-Wild card-application-mapping-can-disable-Default-Document-resolu tion.aspx
http://blogs.msdn.com/david.wang/archive/2005/10/16/Why-Wild card-application-mapping-is-not-catching-404s.aspx
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//