|
-
Aug 22nd, 2008, 02:00 PM
#1
Re: [2005] Issues with re-writing URLs and Global.asax
 Originally Posted by kasracer
So I setup Global.asax to manage my URLs and it works great in my development environment (running on the Visual Studio server) but when I publish the site and place it under IIS (IIS 7; Vista) to test it, it doesn't seem to work at all.
Is there something I'm missing?
All of my URL re-writing is done in the Application_BeginRequest event using Context.RewritePath.
Small snippet:
Code:
List<string> Args = new List<string>(HttpContext.Current.Request.Path.Split('/'));
Args.RemoveAll(EmptyString);
if (Args.Count > 0)
{
switch (Args[0].ToUpper())
{
case "ABOUT":
Context.RewritePath("/Pages/About.aspx");
break;
}
}
Would it be better to convert to using an Http Handler?
Not so fast. Test it out first.
Go to the web project properties and assign to a virtual directory under IIS (or let VS create the virtual directory for you). See if it works.
Then, another small test - modify your hosts file to make localhost.whatever.com point to 127.0.0.1, make a new Web Site in IIS, point it to the directory where your files are and attempt to browse to it while VS is running so that you can debug and look at the values coming in, while at the same time emulating the 'test' conditions as closely as possible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|