how to redirect ot desired page after forms authentication
-
hi... how can i redirect to desired page after forms authentication is successful from the login page instead of redirecting to "default.aspx" which my application is redirecting to? thanks for help in advance.
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want always..:)"
-
hi... how can i redirect to desired page after forms authentication is successful from the login page instead of redirecting to "default.aspx" which my application is redirecting to? thanks for help in advance.
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want always..:)"
i am not very experienced in ASP.NET but what i would do is put the redirecting code in the pageload event of the default.aspx page. so, when a user is redirected from the login page to the default.aspx page, the code can determine where to redirect the user according to the information stored in the authentication cookie. hope this helps.;)
-
i am not very experienced in ASP.NET but what i would do is put the redirecting code in the pageload event of the default.aspx page. so, when a user is redirected from the login page to the default.aspx page, the code can determine where to redirect the user according to the information stored in the authentication cookie. hope this helps.;)
thnks for your help and also for trying. thts a good suggestion.but i have solved it by changing my default page which should load after login to "default.aspx" so its working . BUT I dont want to do like that but i want to know how can i redirect to specified page . thnks for help in advance
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"
-
thnks for your help and also for trying. thts a good suggestion.but i have solved it by changing my default page which should load after login to "default.aspx" so its working . BUT I dont want to do like that but i want to know how can i redirect to specified page . thnks for help in advance
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"
for example you have a page called "abc.aspx" which user should do login here...ok? you need another page called "def.aspx" to appear after the user have login. So you need to define a bool variable forexample " check " ... then set the check ( boolean ) with ur login statement ( checking user name and password ) ...then if the "check" is true then u need to have a code there to redirect to "def.aspx"
-
for example you have a page called "abc.aspx" which user should do login here...ok? you need another page called "def.aspx" to appear after the user have login. So you need to define a bool variable forexample " check " ... then set the check ( boolean ) with ur login statement ( checking user name and password ) ...then if the "check" is true then u need to have a code there to redirect to "def.aspx"
thnks for suggestion sorry ,may be i am not clear or not able to understand what you explained me. but as u know once we turn on the forms autenticaion as successful FormsAuthentication.RedirectFromLoginPage(userid, True) then it redirects to "default.aspx" so we have no chance to redirect to desired page using response.redirect or any other way. can u please explan me clearly your logic or procedure ..you may write a dummy code if u wish thnks a lot
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"
-
thnks for suggestion sorry ,may be i am not clear or not able to understand what you explained me. but as u know once we turn on the forms autenticaion as successful FormsAuthentication.RedirectFromLoginPage(userid, True) then it redirects to "default.aspx" so we have no chance to redirect to desired page using response.redirect or any other way. can u please explan me clearly your logic or procedure ..you may write a dummy code if u wish thnks a lot
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"
if (txtuser.Text.Trim().Length>0 && txtpass.Text.Trim().Length>0 ) { bool Success; //here you should set your dataset = class or any other "if.." to check if the login is true or not . your dataset should return Success ( it meants " out,bool" ) if(Success) { System.Web.HttpContext.Current.Response.Redirect("WebForm2.aspx"); }
-
if (txtuser.Text.Trim().Length>0 && txtpass.Text.Trim().Length>0 ) { bool Success; //here you should set your dataset = class or any other "if.." to check if the login is true or not . your dataset should return Success ( it meants " out,bool" ) if(Success) { System.Web.HttpContext.Current.Response.Redirect("WebForm2.aspx"); }
thanks for reply, but its not working the reason i suppose is given below you are using response.redirect() then you not saying that the forms authentication is successful to the server without using the function FormsAuthentication.RedirectFromLoginPage(userid, True) so the page redirection is not working so please suggest me any other way if possible... thank you -- modified at 9:29 Wednesday 21st February, 2007
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"