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
zeeShan anSari wrote:
forms defaultUrl="~/PresentationLayer/Forms/Main.aspx"
Check whether replacing ~/PresentationLayer/forms with PresetationLayer/forms does cure ....:rose:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
zeeShan anSari wrote:
forms defaultUrl="~/PresentationLayer/Forms/Main.aspx"
Check whether replacing ~/PresentationLayer/forms with PresetationLayer/forms does cure ....:rose:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
it does not working. and bellow message show on page Server Error in '/exxnew' Application. -------------------------------------------------------------------------------- The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /exxnew/~/PresentationLayer/Forms/Main.aspx now i use
Response.Redirect("/PresentationLayer/Forms/Main.aspx",false);
it's work well on local host but on live host its append /~
-
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
AFAIK ASP.NET does not translate ~ into your root web application path when used within the defaultUrl attribute. You can most likely be able to replace it with /exxnew/PresentationLayer/Forms/Main.aspx (where /exxnew denotes your prod website's virtual root path)
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin Edbert Sydney, Australia