| | |
Simple ASP.Net Login Page (Using VB.Net)
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
Ok, several people have replied to this (both here and on private messages) about having difficulty with this code. Remember this is only a guide!
But for the sake of simplicity, I will post the files associated with this snippet!
Login_HTML.aspx.txt (2.2 KB) - The Login.aspx Web Form HTML
Login_VBNET.aspx.vb.txt (6.0 KB) - The Login.aspx.vb Web Form Code behind (VB.Net)
Web.Config.txt (6.2 KB) - The Web.Config I used
Northwind.zip (409.6 KB) - Northwind Database with Login Table and Stored Procedure.
Hope this helps!
But for the sake of simplicity, I will post the files associated with this snippet!
Login_HTML.aspx.txt (2.2 KB) - The Login.aspx Web Form HTML
Login_VBNET.aspx.vb.txt (6.0 KB) - The Login.aspx.vb Web Form Code behind (VB.Net)
Web.Config.txt (6.2 KB) - The Web.Config I used
Northwind.zip (409.6 KB) - Northwind Database with Login Table and Stored Procedure.
Hope this helps!
•
•
Join Date: Oct 2004
Posts: 1
Reputation:
Solved Threads: 1
please help me, i have problems
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found.
Source Error:
Line 14: debugging ASP.NET files.
Line 15: -->
Line 16: <compilation defaultLanguage="vb" debug="true"><assemblies><add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.ReportSource, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Shared, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies></compilation>
Line 17:
Line 18: <!-- CUSTOM ERROR MESSAGES
what can i do?
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found.
Source Error:
Line 14: debugging ASP.NET files.
Line 15: -->
Line 16: <compilation defaultLanguage="vb" debug="true"><assemblies><add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.ReportSource, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Shared, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies></compilation>
Line 17:
Line 18: <!-- CUSTOM ERROR MESSAGES
what can i do?
Last edited by woden; Oct 18th, 2004 at 12:41 pm. Reason: wrong
•
•
•
•
Originally Posted by woden
please help me, i have problems
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found.
Source Error:
Line 14: debugging ASP.NET files.
Line 15: -->
Line 16: <compilation defaultLanguage="vb" debug="true"><assemblies><add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.ReportSource, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Shared, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies></compilation>
Line 17:
Line 18: <!-- CUSTOM ERROR MESSAGES
what can i do?
OK thanks for posting the error message, but that helps little when you are not providing a description of what you were doing or trying to do?
When do you get this error message? For this login? I don't think so, as Crystal Decisions is used for generating reports, not a login.
Please provide more details, files involved, and maybe then I can help.
Re: Can Give Simple ASP.Net Login Page (Using VB.Net) With SQL Server Database??
0
#16 Dec 17th, 2004
•
•
•
•
Originally Posted by arsenal
Can i get a sample of login page using SQL Server 2000 but not Access????
because i do not know how to change the code by using SQL Server 2000
Hope can help me...
it's urgent
thanks a lot
OK, this shouldn't be too hard to piece together from the basic structure I have provided above. But since you are not the first person to ask me about this I feel I should provide some of the changes that need to be made to the code to use SQL Server.
Ok remember that you require the creation of a connection object inorder to access the SQL Database. The basics for the connection string (the means of creating this connection object) is;
Imports System.Data.SqlClient
...
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=myDatabaseName;" & _
"Integrated Security=SSPI"
oSQLConn.Open()
or if you are using a remote server this is the basic structure:
(via IP address):
oSQLConn.ConnectionString = "Network Library=DBMSSOCN;" & _
"Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=myDatabaseName;" & _
"User ID=myUsername;" & _
"Pas sword=myPassword"
But I will show below the changes you could do to the above code and still use the Web.Config file (much more secure).
New Web.Config (partial code only, not the whole file)
<?xml version="1.0" encoding="utf-8"?> <configuration> <!-- ||||| Application Settings ||||| --> <appSettings> <add key="strConn" value="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;"/> </appSettings> <system.web>
The updated heading to all ASP.Net Page Code Behinds (still using VB.Net):
Imports System.Web.Security ' ||||| Required Class for Authentication Imports System.Data ' ||||| DB Accessing Import ' || The following two IMPORTS are for Access DB & SQL Server DB Respectively ' Imports System.Data.OleDb ' |||||| Access Database Required Import! Imports System.Data.SqlClient Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
Changes needed to create an SQL Connection Object:
' ||||| First is the Connection Object for an Access DB 'Dim MyConn As OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("strConn")) ' ||||| This is the Connections Object for an SQL DB Dim MyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("strConn")) [/b]
Changes to the code for SQL Command Object creation:
' ||||| To Access a Stored Procedure in Access - Requires a Command Object 'Dim MyCmd As New OleDbCommand("sp_ValidateUser", MyConn) ' ||||| To Access a Stored Procedure in SQL Server - Requires a Command Object Dim MyCmd As New SqlCommand("sp_ValidateUser", MyConn)
Now there is other parts of the code you have to change, but from the few I have already done it should be fairly easy to know what other changes need to be made. Those could/would include but not limited to: OleDBParamater Object, OleDbType.Char (this would be SqlDbType.Char ? ), and the OleDbDataReader object to name a few!
Hope this helps, and happy coding!
•
•
Join Date: Dec 2004
Posts: 1
Reputation:
Solved Threads: 1
Re: Can Give Simple ASP.Net Login Page (Using VB.Net) With SQL Server Database??
0
#17 Dec 22nd, 2004
ammm .. is this what i want? .. amm .. :-|
i am using MS Access as the backend for my website .. and VB .NET as the front end ..
do i have to type in alllllll that code for the login thing? ..
i mean only registered members can log in .. how can i do that? .. the registeration thingy is working ..
..
..Re: Can Give Simple ASP.Net Login Page (Using VB.Net) With SQL Server Database??
0
#19 Jan 4th, 2005
•
•
•
•
Originally Posted by Paladine
Now there is other parts of the code you have to change, but from the few I have already done it should be fairly easy to know what other changes need to be made. Those could/would include but not limited to: OleDBParamater Object, OleDbType.Char (this would be SqlDbType.Char ? ), and the OleDbDataReader object to name a few!
This code has been a very good introduction for me to learn the .Net environment.
I am currently porting/translating an application done in traditional ASP into .Net. However, I am experiencing difficulties using the login example here as a guide. While the page comes up with no errors and the validators work I am having trouble making the application send the user to a different page. (OK I am VERY new to programming in ASP.NET. :o ) I am trying to determine whether the problem is in my code or in the Stored Procedure that I created
; Since the system is not giving me an error message, I am kind of in a quandary.
This is the code for my Stored Procedure (I have changed some of the elements in the example because of some of the application logic.):
CREATE PROCEDURE dbo.ws_ValidateUser
(@wisUser nVarChar(50),
@wisUserPass nVarChar(50))
AS
SELECT
Count(*) as Num_of_Users
FROM
Dbo.Users
WHERE loginName = @wisUser AND Password = @wisUserPass
GO
Does anyone know SQL Server well enough to tell me if there is a problem in this procedure
(I believe I have been consistent in my use of the variable and field names throughout the application, that are different from the original example by Paladine.) Do I need to provide some of the code as well
Re: Can Give Simple ASP.Net Login Page (Using VB.Net) With SQL Server Database??
0
#20 Jan 4th, 2005
Well the SQL looks sound to me. This line of code redirects the client on successful login:
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page!
and if not,
Response.Redirect("Denied.aspx")
Not sure if that helps. But SQL does not affect the Redirection unless you condition statement (which I am not sure what it looks like) bypasses this redirection.
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page!
and if not,
Response.Redirect("Denied.aspx")
Not sure if that helps. But SQL does not affect the Redirection unless you condition statement (which I am not sure what it looks like) bypasses this redirection.
![]() |
Similar Threads
Other Threads in the ASP.NET Forum
- Previous Thread: ASP.Net Directory Problems
- Next Thread: Ready to take up a challenge
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax alltypeofvideos anathor appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash folder form gridview gudi iis image javascript list listbox login maps microsoft mobile mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols parent problem project radio redirect registration relationaldatabases reportemail richtextbox schoolproject search security select sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visualstudio vs2008 web webapplications webdevelopment webprogramming webservice wizard xsl




