Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 25, 2011 09:27 AM by richt
Apr 04, 2011 06:51 PM|LINK
I'm creating a web site which will have usernames and passwords. When someone inputs the correct id and password, I need it to bring up a web page with there name on it and the page which belongs to them only? I have created the database but I now need the
sql code? Can anyone help.
Apr 04, 2011 07:17 PM|LINK
Best thign to do is post the relevant code and how the database is laid out and we should be able to help.
Apr 04, 2011 08:43 PM|LINK
I have a log in page, so when you input your id i want it to go to a specific page related to that one id. Then if someone else logs in they will get the web page related to them. As for code, well thats the problem?? In the long run those pages will pick
up information from a database (hopefully). Hope this makes sense. Thanks.
Apr 04, 2011 09:11 PM|LINK
Apr 05, 2011 12:21 AM|LINK
Apr 05, 2011 01:06 PM|LINK
Is the Your Code in .aspx page
<asp:Login ID="Login1" runat="server" onauthenticate="Login1_Authenticate">
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
if (ValidateFunction(Login1.UserName, Login1.Password))
Login1.Visible = false;
e.Authenticated = false;
private bool ValidateFunction(string UserName, string Password)
bool BoolReturnValue = false;
cn = new SqlConnection(@"Data Source=Dhruval;Initial Catalog=HRMS;Uid=sa;Password=virsap;Connection TimeOut=0");
cmd = new SqlCommand("select * from Login", cn);
SqlDataReader rdr = cmd.ExecuteReader();
if ((UserName == rdr["UserName"].ToString()) & (Password == rdr["Password"].ToString()))
BoolReturnValue = true;
Apr 05, 2011 08:39 PM|LINK
Thanks for this.
I'm using .cshtml pages. I'm then trying to run SQL within that page. This then looks up the database to make sure the correct user is logged in. Hope this makes sense. Thanks.
Apr 05, 2011 08:46 PM|LINK
I have used this upto a point. What I need to do now isn't in there which is a shame. Thanks for the help.
Apr 05, 2011 09:14 PM|LINK
Have you looked at any of the template sites, such as the Starter Site? It has example code for the WebSecurity helpers.
Apr 05, 2011 09:30 PM|LINK
I have, but I'm unable to find anything to make it work.
I'll explain what i'm trying to do. You open your web page and your asked for your username and password this will take you to a generic page. this page will then show information eg; your name, plus total amount of holiday you have. This information is
on a database. So... what Im trying to do is only show the information to the correct username. Hope this makes sense.