Friday, 8 June 2012

return url issue


add this code to the global.asax page

void Application_BeginRequest(object sender, EventArgs e)
   {
       string path = HttpContext.Current.Request.Url.PathAndQuery;
       string pagequery = path.Substring(path.LastIndexOf("/") + 1);
       string[] pagequery_Elements = pagequery.Split('?');
       string ReturnUrl = pagequery_Elements[pagequery_Elements.Length - 1];

       if (ReturnUrl.Contains("ReturnUrl"))
       {        
           Response.Redirect("~/login.aspx", true);
       }
   }