开发者

ASP.Net routing from website root

开发者 https://www.devze.com 2023-03-04 23:28 出处:网络
Say I have a website www.abc123.com. What would be the best way to determine when users attempt to access pages like www.abc123.com/section1 and www.abc123.com/otherStuff ?

Say I have a website www.abc123.com. What would be the best way to determine when users attempt to access pages like www.abc123.com/section1 and www.abc123.com/otherStuff ?

I've done some research and found that Request.PathInfo works quite well when the user visits www.abc123.com/Default.aspx/section1 but it does not work without having the Default.aspx portion included in the URL.

Right now all I get are 404 errors when attempting this with the built in IIS server in VS2k8 and on a published website. I'm using ASP.Net 3.5 and IIS 6 if开发者_Python百科 those things matter.


This works better in IIS7 since it routes all request through the ASP.NET pipeline (not just requests for ASP.NET resources).

In IIS6, I think your best bet would be to write an HTTPModule. I think IIS passes all requests (not just requests for ASP.NET resources) through the HTTPModule pipeline.

In IIS7, you can just use your applications Global.asax to hook into the Application_BeginRequest event.


I am running 3.5 on IIS 6 and there are a few things to do, but it can be done. A post already covers this, look at ASP.NET routing on IIS 6.

0

精彩评论

暂无评论...
验证码 换一张
取 消