when i tried for the url freindly only url is freindly but page is not loading.my code files are below
Global.asax.cs
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute("StoreRoute",
"{Name}",
"~/index1.aspx");
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
string mTemp;
string murl;
try
{
string initialurl = Request.Url.ToString();
mTemp = initialurl.Substring(1, initialurl.LastIndexOf(".")-1);
Context.RewritePath(mTemp);
}
catch (Exception ex)
{
ex.Message.ToString();
}
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
}
index1.cs
public partial class index1 : System.Web.UI.Page
{
static string var = null;
string getLoc = null;
string strURL;
protected void Page_Load(object sender, EventArgs e)
{
string name = Page.RouteData.Values["Name"] as string;
if (!IsPostBack)
{
halim();
}
}
protected void halim()
{
HttpContext context = Context;
string strURL, strURL1;
string name = Page.RouteData.Values["Name"] as string;
if (name != null)
{
if (name == "Aboutus")
{
strURL = "/Aboutus.aspx";
HttpContext.Current.RewritePath("~" + strURL);
}
else if (name == "contactus")
{
strURL = "/contactus.aspx";
Response.Redirect(strURL);
HttpContext.Current.RewritePath("~" + strURL);
}
}
}