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?topi c=sales"
To do this, I created a "sales" folder and put a dummy "default.as px" in it,
then I tried the following codes:
protected void Application_Beg inRequest(Objec t sender, EventArgs e)
{
if (Request.Path.T oLowerInvariant ().IndexOf("sal es/default.aspx")
!= -1)
HttpContext.Cur rent.RewritePat h("/topic.aspx?topi c=sales");
if (Request.Path.T oLowerInvariant ().IndexOf("sup port/default.aspx")
!= -1)
HttpContext.Cur rent.RewritePat h("/topic.aspx?topi c=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?topi c=sales"
To do this, I created a "sales" folder and put a dummy "default.as px" in it,
then I tried the following codes:
protected void Application_Beg inRequest(Objec t sender, EventArgs e)
{
if (Request.Path.T oLowerInvariant ().IndexOf("sal es/default.aspx")
!= -1)
HttpContext.Cur rent.RewritePat h("/topic.aspx?topi c=sales");
if (Request.Path.T oLowerInvariant ().IndexOf("sup port/default.aspx")
!= -1)
HttpContext.Cur rent.RewritePat h("/topic.aspx?topi c=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
Comment