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