Click here to Skip to main content
15,888,287 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Form Authentication how to go to home page after creating a user. it should not redirect the user to login page after the a user fills in the form for registration and clicks on ok the values are saved and the user is redirected to homepage.
Posted
Comments
vinodkumarnie 21-Mar-13 7:26am    
How you are doing authentication in your home page..?

XML
<authentication mode="Forms">

      <forms name="Check" defaultUrl="default.aspx" loginUrl="login.aspx"></forms>
    </authentication>


After user enters valid data and stored in database.
in your codebehind use this

C#
FormsAuthentication.RedirectFromLoginPage("Send Your UserName", false);


Generally, it redirects from login page if not you can use it in your registration page.

try this it works.
 
Share this answer
 
Once the user click on OK button, then validate user entered value.

Then insert the user entry in database.
if the user entry is successfully inserted, 
then 
    redirect user to Home page, 
else 
    redirect to Register page


Code may be like below...
int rowaffected = "INSERT INTO Users Values ('UserName', 'Password')";

//code here to execute query

if(rowaffected >= 1)
{
    Responce.Redirect("Home.aspx");
}
else
{
    Responce.Redirect("Register.aspx");
}
 
Share this answer
 
v2
C#
response.redirect("HomePage.aspx");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900