I am using UltiDev Web Server Pro and have all my aspx files are located in a sub folder 'WebForms'.
I want to be able to default all requests for pages to this folder such that they can just type:
http://myserver/somepage.aspx
instead of
http://myserver/WebForms/somepage.aspx
.
Is this possible?
EDIT:
Here is the VB.NET version of the solution below including a check for case sensitivity:
If Not HttpContext.Current.Request.Path.ToUpper.Contains("/WEBFORMS/") Then
Context.RewritePath("/WebForms" + HttpContext.Current.Request.Path, False)
End If
You can use the Global.asax
and the Application_BeginRequest
to RewritePath
to the final destination and still have the link without the WebForm path.
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if(!HttpContext.Current.Request.Path.Contain("/WebForms/"))
RewritePath("/WebForms" + HttpContext.Current.Request.Path, false);
}