Redirect URL problem
-
hi all :) , this my codebehind on login button click
FormsAuthentication.Initialize(); FormsAuthenticationTicket ObjTicket = new FormsAuthenticationTicket(1, txtLoginId.Text, DateTime.Now, DateTime.Now.AddMinutes(60), false, txtLoginId.Text + "," + txtPassword.Text, FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ObjTicket); string sLoginId = txtLoginId.Text; sLoginId = sLoginId.Replace(" ", ""); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); Response.Redirect(FormsAuthentication.GetRedirectUrl(txtLoginId.Text, false)+"?id="+txtLoginId.Text);
and this is web config code
<authentication mode="Forms">
<forms defaultUrl="~/PresentationLayer/Forms/Main.aspx" loginUrl="~/Default.aspx" >
</forms></authentication>
above code well working on local host .......but on live host "~/" append with url for example i want www.abc.com/abc/PresentationLayer/Forms/Main.aspx but i get www.abc.com/abc/~/PresentationLayer/Forms/Main.aspx can anybody tell me that where is problem
-
hi all :) , this my codebehind on login button click
FormsAuthentication.Initialize(); FormsAuthenticationTicket ObjTicket = new FormsAuthenticationTicket(1, txtLoginId.Text, DateTime.Now, DateTime.Now.AddMinutes(60), false, txtLoginId.Text + "," + txtPassword.Text, FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ObjTicket); string sLoginId = txtLoginId.Text; sLoginId = sLoginId.Replace(" ", ""); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); Response.Redirect(FormsAuthentication.GetRedirectUrl(txtLoginId.Text, false)+"?id="+txtLoginId.Text);
and this is web config code
<authentication mode="Forms">
<forms defaultUrl="~/PresentationLayer/Forms/Main.aspx" loginUrl="~/Default.aspx" >
</forms></authentication>
above code well working on local host .......but on live host "~/" append with url for example i want www.abc.com/abc/PresentationLayer/Forms/Main.aspx but i get www.abc.com/abc/~/PresentationLayer/Forms/Main.aspx can anybody tell me that where is problem
try the Asp.NET forum.
Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]