Question

Locked

Url Problem in Global.ascx File

By AmjadHussain ·
My live site Url is http://www.Amjad.com and when i am using this url like http://test.Amjad.com and Page redirect to login page http://www.Amjad.com/Admin/Login.aspx?URL=test please send me the code of this process

I have already write some code but its create problem
protected void Application_BeginRequest(object sender, EventArgs e)
{
//if (!Request.CurrentExecutionFilePath.EndsWith(".aspx")) return;
//if (!Request.CurrentExecutionFilePath.EndsWith("/")) return;

string strURL = HttpContext.Current.Request.Url.AbsoluteUri.ToString();
//try
//{
//string strURL = System.IO.Path.GetFullPath(Request.PhysicalPath);
Response.Write(strURL);
Regex rewrite_regex = new Regex(@"(.+)\/((.+)\.aspx)", RegexOptions.IgnoreCase);
MatchCollection match_rewrite = rewrite_regex.Matches(strURL);
if (match_rewrite.Count < 1)
{
string ur = strURL.Substring(strURL.LastIndexOf("/") + 1);
HttpContext.Current.Response.Redirect("http://www.Amjad.com/Admin/Login.aspx?URL=" + ur);


//HttpContext.Current.Response.Redirect("http://www.clock.ie/Admin/Login.aspx?URL=" + ur.ToString());
// HttpContext.Current.Response.Redirect("http://localhost:1618/ClockSpot/Admin/Login.aspx?URL=" + ur.ToString());
//Context.RewritePath("http://www.clock.ie/Admin/Login.aspx?URL=" + ur.ToString());


//string ur1 = strURL.Substring(strURL.LastIndexOf("//") + 2);
//Response.Write(ur1);
//string[] s = ur1.Split('.');
//if (s[0] != "www")
//{
// HttpContext.Current.Response.Redirect("http://www.clock.ie/Admin/Login.aspx?URL=" + s[0].ToString());
//}
}

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Windows Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums