R
Raymon Du
Hi,
This is te first time I use url rewriting. What I am trying to accomplish:
Hide the .aspx extension and give user a shorter path to type, say the user
can type "/sales" in browser and the browser will display
"/topic.aspx?topic=sales"
To do this, I created a "sales" folder and put a dummy "default.aspx" in it,
then I tried the following codes:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Request.Path.ToLowerInvariant().IndexOf("sales/default.aspx")
!= -1)
HttpContext.Current.RewritePath("/topic.aspx?topic=sales");
if (Request.Path.ToLowerInvariant().IndexOf("support/default.aspx")
!= -1)
HttpContext.Current.RewritePath("/topic.aspx?topic=support");
the browser displays the correct html, but all the images become broken and
all links are linked to "sales" folder instead of application root. I know I
did it wrong, just don't know how to correct it.
TIA
This is te first time I use url rewriting. What I am trying to accomplish:
Hide the .aspx extension and give user a shorter path to type, say the user
can type "/sales" in browser and the browser will display
"/topic.aspx?topic=sales"
To do this, I created a "sales" folder and put a dummy "default.aspx" in it,
then I tried the following codes:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Request.Path.ToLowerInvariant().IndexOf("sales/default.aspx")
!= -1)
HttpContext.Current.RewritePath("/topic.aspx?topic=sales");
if (Request.Path.ToLowerInvariant().IndexOf("support/default.aspx")
!= -1)
HttpContext.Current.RewritePath("/topic.aspx?topic=support");
the browser displays the correct html, but all the images become broken and
all links are linked to "sales" folder instead of application root. I know I
did it wrong, just don't know how to correct it.
TIA