2

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 those things matter.

Crag
  • 458
  • 4
  • 14

2 Answers2

1

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.

Joe Enzminger
  • 11,110
  • 3
  • 50
  • 75
  • IIS7 would be nice, but at the time it isn't an option. I'll look into the HTTPModule though. – Crag May 11 '11 at 16:10
  • The HTTPModule is going to work. I'm just handling the Request.Path to determine if the request is coming from the root and properly formatted, and sending the user to the correct page if it is. Thanks again. – Crag May 11 '11 at 20:34
0

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.

Community
  • 1
  • 1
Wade73
  • 4,359
  • 3
  • 30
  • 46