| | |
Updated : Simple ASP.Net Login Page
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
•
•
Originally Posted by angelicjess
Sorry, I'm kinda noob in this... I do not know how to find out my version of ASP.NET.
I insert Imports.System.Data.SqlClient on top, although the KeyName is no longer showing error but when I used breakpoint, this statement show error >>> Dim MyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Is the information enough?
When keywords are not recognized, that is the first thing to check.
**Copy and Paste doesn't always solve this**

Imports System.Web.Security ' |||||| Required Class for Authentication
Imports System.Data ' |||||| DB Accessing Import
Imports System.Data.SqlClient ' |||||| SQL Server Import
Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||And be sure you have this line in your Web.Config file.
<appSettings>
<add key="strConn" value="Network Library=DBMSSOCN;Data Source=192.168.0.100,1433;database=Northwind;User id=;Password=;"/>
</appSettings>Let me know how it goes..
•
•
Join Date: May 2006
Posts: 7
Reputation:
Solved Threads: 0
Sorry, let me give you a clearer picture first. I'm using Access Database and I named my Database as User.mdb. My table is called tblUser. Inside the table got U_id, U_Name and U_Password. I haven't create any Query because the SQL statement you wrote on the first page will always prompt me the value of the parameter. So in the end I deleted it. Is it purpose to be this way?
I also create a Login Page named Login.aspx. My form have:
- txtUsername
- txtPassword
- cmdSubmit
- lblMessage
Thus, I would like to learn from you what should I put for my query and how can I connect to the Access Database so that my login page is workable? I really appreciate your help. =) Thank you in advance!
I also create a Login Page named Login.aspx. My form have:
- txtUsername
- txtPassword
- cmdSubmit
- lblMessage
Thus, I would like to learn from you what should I put for my query and how can I connect to the Access Database so that my login page is workable? I really appreciate your help. =) Thank you in advance!
•
•
•
•
Originally Posted by angelicjess
Sorry, let me give you a clearer picture first. I'm using Access Database and I named my Database as User.mdb. My table is called tblUser. Inside the table got U_id, U_Name and U_Password. I haven't create any Query because the SQL statement you wrote on the first page will always prompt me the value of the parameter. So in the end I deleted it. Is it purpose to be this way?
I also create a Login Page named Login.aspx. My form have:
- txtUsername
- txtPassword
- cmdSubmit
- lblMessage
Thus, I would like to learn from you what should I put for my query and how can I connect to the Access Database so that my login page is workable? I really appreciate your help. =) Thank you in advance!
First off I highly recommend you READ through the tutorial again. I am being serious, and not in a bad way.
Why? Your statement:
•
•
•
•
I haven't create any Query because the SQL statement you wrote on the first page will always prompt me the value of the parameter. So in the end I deleted it. Is it purpose to be this way?
To begin this SQL statement used in Access is correct:
ASP.NET Syntax (Toggle Plain Text)
SELECT COUNT(*) AS Num_of_User FROM tblUser WHERE (((tblUser.U_Name)=[@UserName]) AND ((tblUser.U_Password)=[@Password]));
Here is another important point. Your initial error was with the SQLConnection object not being recognized, but you are now saying you are using an Access Database.
Which are you using? An SQL database or Access?
If it is truly Access you are using then the imports you need are those directed at the start of this tutorial:
Imports System.Web.Security ' |||||| Required Class for Authentication Imports System.Data ' |||||| DB Accessing Import Imports System.Data.SqlClient ' |||||| SQL Server Import Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
Hope this helps.
•
•
Join Date: May 2006
Posts: 7
Reputation:
Solved Threads: 0
I'm Sorry... The login page is still not working. I do not know what went wrong. I'm using Access DB.
Imports System.Web.Security ' |||||| Required Class for Authentication
Imports System.Data ' |||||| DB Accessing Import
Imports System.Data.SqlClient ' |||||| SQL Server Import
Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
I've changed the above code from Imports.System.Data.SqlClient to Imports.System.Data.OleDBConnection. Because I'm not using SQL Server. Am I right to do so? I've also create a new databse which I had followed the codes on the first page. So could you paste the rest of the codes which I need for me? The first page is kinda confusing for me. I'm really new at this. This is the first time I'm doing this. Please...
Imports System.Web.Security ' |||||| Required Class for Authentication
Imports System.Data ' |||||| DB Accessing Import
Imports System.Data.SqlClient ' |||||| SQL Server Import
Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
I've changed the above code from Imports.System.Data.SqlClient to Imports.System.Data.OleDBConnection. Because I'm not using SQL Server. Am I right to do so? I've also create a new databse which I had followed the codes on the first page. So could you paste the rest of the codes which I need for me? The first page is kinda confusing for me. I'm really new at this. This is the first time I'm doing this. Please...
•
•
Join Date: Jun 2006
Posts: 1
Reputation:
Solved Threads: 0
Greetings all. I am very green at .net, learning as I go at this point. Is there a way to "adapt" the code here to be usable on the 2.0 Framework? I am building a basic webform for a project at work that pulls a dropdown list from an SQL DB, and I have an editing page to manage it, but of course it needs to be protected so anyone can't just go in and make changes. I build the entire login script based on the notes here, with the usual couple tweaks, but get the error "A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll" when I run in debug mode after entering the name/password. The form always returns the "invalid login!" message regardless as well. I am writing in vb.net 2k5 at this time, but haven't learned all the features as of yet either. -- Thanks for any assistance anyone can provide! --
•
•
•
•
Originally Posted by E_Hobbie_Coder
Greetings all. I am very green at .net, learning as I go at this point. Is there a way to "adapt" the code here to be usable on the 2.0 Framework? I am building a basic webform for a project at work that pulls a dropdown list from an SQL DB, and I have an editing page to manage it, but of course it needs to be protected so anyone can't just go in and make changes. I build the entire login script based on the notes here, with the usual couple tweaks, but get the error "A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll" when I run in debug mode after entering the name/password. The form always returns the "invalid login!" message regardless as well. I am writing in vb.net 2k5 at this time, but haven't learned all the features as of yet either. -- Thanks for any assistance anyone can provide! --
You say you are using VB.Net 2K5? Well this code only works with ASP.NET 1.0 or 1.1. It will not function (do to several Framework changes) in ASP.NET 2.0, or VB.NET 2k5 (which would require major code changes to from this tutorial).
Provide the code you are having issues with and I can see what I can do to help.
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Solved Threads: 0
Hi,
I'm new to ASP.net and SQl server,
I'm using VS 2003 and SQL 2005 express edition,
I followed thru out ur tutorial , but still ve problem with building my first login page..
After I click the submit button..lblmessage2.= become visible which is
"Error Connecting to Database!"
I tried playing around with my connection string but its still the same..
my current connection string
I'm using window authentication...tried several connection string...but i still cannot connect to the db..other then the connection string..others codes are the same as ur tutorial..
I'm new to ASP.net and SQl server,
I'm using VS 2003 and SQL 2005 express edition,
I followed thru out ur tutorial , but still ve problem with building my first login page..
After I click the submit button..lblmessage2.= become visible which is
"Error Connecting to Database!"
I tried playing around with my connection string but its still the same..
my current connection string
<appSettings> <addkey="strConn"value="Data Source=(local);database=fypDB;User id=;Password=;"/> </appSettings>
I'm using window authentication...tried several connection string...but i still cannot connect to the db..other then the connection string..others codes are the same as ur tutorial..
Last edited by Paladine; Jun 17th, 2006 at 12:59 pm.
try
<add name="strConn" connectionString="Data Source=P4C800E\SQLEXPRESS;Initial Catalog=pubs;Integrated Security=True" providerName="System.Data.SqlClient" />
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Paladine
try
<add name="strConn" connectionString="Data Source=P4C800E\SQLEXPRESS;Initial Catalog=pubs;Integrated Security=True" providerName="System.Data.SqlClient" />
Parser Error Message: Unrecognized attribute 'providerName' Source Error: Line 2: <configuration> Line 3: <appSettings> Line 4: <add key="strConn" value="Data Source=SHINGREY2\SQLEXPRESS;database=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/> Line 5: </appSettings>Line 6: <system.web>
So your datasource is SQLEXPRESS and not some other name?
Also, you have left left the Database as Northwind, and your previous post showed that your database is fypDB So make sure you taylor the string for you specific instance.
Also, the providerName is not required, that was out of ASP.NET 2.0. My apologies, bu the error message tells you what is wrong, so remove the portion that is unrecognized.
The error will occur on the Submit, because that is when the application makes a call to the Database.
Should be: (at least try this)
<addkey="strConn"value="Data Source=(local);Initial Catalog=fypDB;Integrated Security=True""/>
Also, you have left left the Database as Northwind, and your previous post showed that your database is fypDB So make sure you taylor the string for you specific instance.
Also, the providerName is not required, that was out of ASP.NET 2.0. My apologies, bu the error message tells you what is wrong, so remove the portion that is unrecognized.
The error will occur on the Submit, because that is when the application makes a call to the Database.
Should be: (at least try this)
<addkey="strConn"value="Data Source=(local);Initial Catalog=fypDB;Integrated Security=True""/>
Last edited by Paladine; Jun 17th, 2006 at 2:46 pm.
![]() |
Similar Threads
Other Threads in the ASP.NET Forum
- Previous Thread: Parent and Child Classes
- Next Thread: Creating waiting page in ASP.net
Views: 188541 | Replies: 152
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list maps menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





