WARNING AND NOTICE

All tricks in this blog are only for educational purpose. Learn these tricks only for your knowledge. Please donot try these to harm any one. We will not take any responsibility in any case. All softwares and tools on this site are here for private purposes only and If you want to use a software for business purpose, please purchase it. I do not host many of these tools. I Post links that I have found from numerous Search engines. I will not be responsible for any of harm you will do by using these tools.

Readmore

Thursday, September 23, 2010

ASP.NET Cookie Login

1. Create dmx login form, dataset and validate it Note: The code in this article is for documents that use the ASP.NET/VB server model. Step 1 1. Create a new asp.net/vb page and name it login.aspx.2. Create a login form with 2 asp:textboxes and 1 asp:button. Use the asp.net web server controls from Insert> ASP.NET Objects. Make sure the controls are within the form tag (dmx should do this by default.)For the username text box:ID = txtusernameText mode = Single Line For the password textbox:ID = txt password Text mode = Password For the button:ID = btn_loginText = Login Step 2 Now let’s create a Data Set to retrieve the users stored in the users table. We have to filter this dataset by the username and password that will be submitted by the login form we created for the user above. 1. Application Panel > Server Behaviors > + > DataSet2. Name your dataset ds_checkuserinfo. 3. For the SQL select your user id, username and user password columns from the users table. Filter by the username and user password columns. The highlighted text in the image below are the names of 2parameters that will reflect the values of the 2 text boxes. Here is my SQL. Obviously, change the names of the columns and table to reflect your own, but do notchange the parameter names (that are highlighted in the image and in pink below):SELECT user_id, user_name, user_pwdFROM tbl_usersWHERE user_name = @user_name AND user_pwd = @userpwd Step 3 Now let’s add the parameters which will reflect the values submitted in the 2 textboxes of the form, onewhich is named txtusername and the other txtpassword.1. From the Parameters section, click the plus (+) sign.Name the parameter @user_name. Change the Type to WChar. Click the Build button. 2. Name the build value txtusername and get the source from the Form Variable and click OK. (This is usingthe value of whatever is submitted in the txtusername textbox as the value of the parameter.)

Download ASP.NET Cookie Login.

0 comments:

Post a Comment