Simple ASP.Net Login Page (Using VB.Net)

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2004
Posts: 4
Reputation: curiosity5 is an unknown quantity at this point 
Solved Threads: 1
curiosity5 curiosity5 is offline Offline
Newbie Poster

Re: Simple ASP.Net Login Page (Using VB.Net)

 
0
  #11
Sep 17th, 2004
Ok i give up.
I'm using visual.net.
Please help!!
Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Simple ASP.Net Login Page (Using VB.Net)

 
0
  #12
Sep 18th, 2004
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!
Attached Files
File Type: txt Login_HTML.aspx.txt (2.2 KB, 1240 views)
File Type: txt Login_VBNET.aspx.vb.txt (6.0 KB, 1155 views)
File Type: txt Web.Config.txt (6.2 KB, 1001 views)
File Type: zip Northwind.zip (409.6 KB, 1002 views)
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Quick reply to this message  
Join Date: Oct 2004
Posts: 1
Reputation: woden is an unknown quantity at this point 
Solved Threads: 1
woden woden is offline Offline
Newbie Poster

Re: Simple ASP.Net Login Page (Using VB.Net)

 
-1
  #13
Oct 18th, 2004
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?
Last edited by woden; Oct 18th, 2004 at 12:41 pm. Reason: wrong
Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Simple ASP.Net Login Page (Using VB.Net)

 
0
  #14
Oct 18th, 2004
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.
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Quick reply to this message  
Join Date: Dec 2004
Posts: 1
Reputation: arsenal is an unknown quantity at this point 
Solved Threads: 1
arsenal arsenal is offline Offline
Newbie Poster

Can Give Simple ASP.Net Login Page (Using VB.Net) With SQL Server Database??

 
0
  #15
Dec 17th, 2004
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
Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

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!

Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Quick reply to this message  
Join Date: Dec 2004
Posts: 1
Reputation: urbanXroadsjr is an unknown quantity at this point 
Solved Threads: 1
urbanXroadsjr urbanXroadsjr is offline Offline
Newbie Poster

Re: Can Give Simple ASP.Net Login Page (Using VB.Net) With SQL Server Database??

 
0
  #17
Dec 22nd, 2004
Don't worry I'm in the same boat as you in using SQL Server, When I figure it out I'll let you know. I'm a novice to ASP.NET also.
Quick reply to this message  
Join Date: Dec 2004
Posts: 440
Reputation: Sulley's Boo will become famous soon enough Sulley's Boo will become famous soon enough 
Solved Threads: 10
Sulley's Boo's Avatar
Sulley's Boo Sulley's Boo is offline Offline
Posting Pro in Training

Simple ASP.Net Login Page (Using VB.Net)

 
0
  #18
Dec 31st, 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 .. ..

..
Quick reply to this message  
Join Date: Dec 2004
Posts: 10
Reputation: Javaknight is an unknown quantity at this point 
Solved Threads: 1
Javaknight's Avatar
Javaknight Javaknight is offline Offline
Newbie Poster

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!
Experts,

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
Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

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.
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Quick reply to this message  
Closed Thread

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC