Abdul Amin Khan

Abdul Amin Khan

  • 1.1k
  • 605
  • 21.5k

#DivName not supporting in URL Rewriting/Routing

Feb 21 2017 2:06 AM
Dear All,
 
Anyone can help me on this,
There is showing resource not found in URL rewriting/Routing when i use #DivName in url 
but this url is working fine directly.
 
Given Code when i use MainPage  it is working fine but when we use App/ or Contact-Us/ it is showing resource not found.
 
Please clear where i am wrong in this code. 
 
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>

<script RunAt="server">

void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoute(System.Web.Routing.RouteTable.Routes);
}

void Album4lifeRoute(System.Web.Routing.RouteCollection route)
{
route.MapPageRoute("HomePage", "mainpage/", "~/Index.aspx");
route.MapPageRoute("AppPage", "App/", "~/Index.aspx/AppName");
route.MapPageRoute("ContactUs", "contact-us/", "~/Index.aspx#ContactUs");
}

void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown

}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs

}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started

}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
</script>

 
 

Answers (2)