That would be nice. Waiting to hear from you ....

Many Thanks.

Ok I have started a new thread, from the very basics of the Login Page. This is a little more than your basic page, but it is still relatively simple. Cut and Paste the code into a new project following my steps and you should have no problems.

Enjoy!

New Thread

hello ,
i ve reffered ur asp.net login form creation but i m not getting that will u tell me in more broader way so that i can do by reffering ur code .i did same thaing what u gave in ur thread but i m not getting will u tell me simpler way to create the login page ,actually i m creating the issue list for the company i want to use this login page as-->
first when we open the logine page it must contain
name of employee: _________
Password :__________
Enter
when we enter it should show the issue list of that employee.
will u plz help me to do this in my project.
thank u
waiting for ur reply.

above error i m getting in my application


Compiler Error Message: BC30035: Syntax error in line 6

Source Error:

Line 4: ' Insert page code here
Line 5: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 6: Imports System.Web.SecurityLine 7: Imports System.Data
Line 8: Imports System.Data.OleDb

See the updated link! But this code is functional. And why are your imports after the Page_Load Event, they must appear before the class declaration.

So please check your coding. Even copy and paste is not simple if you paste it in the wrong spot...all depends on where you cursor is. Right?

So line 6, 7 , and 8 are in the wrong spot.

Hope this helps

above error i m getting in my application


Compiler Error Message: BC30035: Syntax error in line 6

Source Error:

Line 4: ' Insert page code here
Line 5: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 6: Imports System.Web.SecurityLine 7: Imports System.Data
Line 8: Imports System.Data.OleDb

Would love to help. First, use the new thread link above to see a more refined code.

Broader way? Not sure what you are saying I said by that? Sorry, please help me to understand.

And You want to change what, how the Login Box appears. It should say Name of Employee instead of Username? And Password will remain the same? Is that what you are saying?

And what is this list you are referring to? What list? Where?

Please....I would love to help, but you MUST BE CLEAR about what you are asking or having problems with, REMEMBER I am not working on the same thing you are, so I need to have it in detail if you wish me to help you.

Please send me a private message with the details if you do not want to post them here.

And use the UPDATED LINK to the NEW THREAD for the most up to date listing of this CODE!

hello ,
i ve reffered ur asp.net login form creation but i m not getting that will u tell me in more broader way so that i can do by reffering ur code .i did same thaing what u gave in ur thread but i m not getting will u tell me simpler way to create the login page ,actually i m creating the issue list for the company i want to use this login page as-->
first when we open the logine page it must contain
name of employee: _________
Password :__________
Enter
when we enter it should show the issue list of that employee.
will u plz help me to do this in my project.
thank u
waiting for ur reply.

thank u for ur reply.
actually i m developing one website for one company ,that website contains many things like in its sumenu it contains issue list ,time sheet, team activities etc ,so when i click on the issue list submenu it should link to the issue list page where i should enter following things

employee ID:_______
Password :_______
ya u r correct password should remain same ,in the employee ID we r storing each employees id's and in password we r storing password of each employee which r given by the comapny itself, so now when i enter employee ID and password of each employee it should open the page containing the issue list of that employee .
so how to do this. hope this time u understood what i want to tell .
plz send me reply as soon as possible ,i want the code for this ,i m trying it since from 1 and half month but i m not getting this when i saw ur site i felt as if i got the solution.plz help me.
thank u.

OK I think I have a better understanding of what you are trying to do, but dont see where you are having the difficulty. You have a selection from an Issue list Menu and then following the selection the employee must login and then a page will open with the issue list they selected. Let me see if this helps.

So this Login page is the second part to your Event(s) path. So, create the page with the Menus on it (i.e. Team activities, etc) which are apparently visible prior to login, which I don't understand, but again I am not working on this project so I am a little fuzzy on the details. Never the less, you would then have this login page to validate the Employee, and then the default.aspx would display the issue list of that employee.

Simple. The data for that issue list for that specific employee would have to be stored in the database (SQL , Access or Oracle for that matter) and would be related to the employee in some way. So like the login you are retrieving the data based on specific criteria being supplied. In the case of the issue list if the login is successful the retrieved data (issue list) will be specific to the employee thus part of your where clause in the SELECT statement / or Query.

So for example, without knowing your ERD (Entity Relationship Diagram) or the Data Structure for the project I would have the following;

Following tables with the following columns

tblLogin

  • EmployeeID (Would have to be Unique, and thus No Duplicates Allowed)
  • Password

tblEmployee_IssueList

  • EmployeeID
  • IssueListID
  • Miscellaneous (Any other columns you feel you need here)

tblIssueList

  • IssueListID (A UNIQUE Value, No Duplicates)
  • IssueList_Desc (Details for that IssueList)
  • Miscellaneous (Any other columns you feel you need here)

tblLogin 1 : N Relationship to tbl_Employee_IssueList N : 1 Relationship to tblIssueList

N = Many
1 = One

Assuming you are using SQL, but the same principles apply to Access and using the Query Builder
So your SELECT Statement would be something like this for retrieving the Issue List Details or Description :

SELECT IssueList_Desc
FROM tblIssueList
WHERE IssueListID = @IssueListSelected

Where the @IssueListSelected will be passed to this from the selection from the menu by the employee. I would store the value in a session variable which can be passed from the initial selection page to the Login Page which will use it once the login is successful.

This SELECT would be in a stored Procedure in SQL or a param Query built in Access (depending on your backend joice for the data access layer).

Hope this helps

Thanks for the code Paladine. I am working with SQLServer DB version. When I ran it, I got the error complain that the SqlConnection, MyCmd, MyConn were undefined.

And you have a declaration of MyCmd ? You have the MyConn in the Web.Config correct? And what version of SQL DB are you using? Here is something to note:

"
The SQL Server .NET Data Provider allows you to connect to a Microsoft SQL Server 7.0 or 2000 database. For Microsoft SQL Server 6.5 or earlier, use the OLE DB .NET Data Provider with the "SQL Server OLE DB Provider" (SQLOLEDB).

Note: The SQL Server .NET Data Provider knows which data provider it is. Hence the "provider=" part of the connection string is not needed. "


I am working on the updated SQL version on the NEW THREAD soon.

But sometimes, and this is just Visual Studio's bug, if you copy and paste my code you may have to save and actually exit the application and then reload the ASP.Net Application in Visual Studio to have it see all the declarations you just pasted in. That should eliminate the squiggly lines under the underclared variables (and eliminate the messages associated with them).

If you are still having problems, Private Message me and I will try to solve them.

Happy Coding!

I'm using SQLServer 7.0

My strConnection in web.config
<appSettings>
<add key="connString" value="server=myDBServer;uid=myid;pwd=myPass;database=myDB" />
</appSettings>

For SQL, I common out the Access thing, and use the syntax for SQL as you suggested:

' First is the Connection Object for an Access DB
' Dim MyConn As OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("connString"))

' This is the Connections Object for an SQL DB
SqlConnection(ConfigurationSettings.AppSettings("connString"))

and I got the error here saying that SqlConnection was not declared.
I thought the import we need for SQLServer is Imports System.Data.SqlClient
not Imports System.Data.OleDb

Hi there Kendel,

You are correct about the import, and if you recall on the Tutorial in the comments I state that very thing:

"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()
....

"

and here futher down in the same post

The updated heading to all ASP.Net Page Code Behinds (still using VB.Net):

'   |||||   This is the Connections Object for an SQL DB
  Dim MyConn As [b]SqlConnection [/b]= New SqlConnection(ConfigurationSettings.AppSettings("strConn"))

And further down in the post I state the following as well :

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
  [b]Imports System.Data.SqlClient[/b]
  Imports System.Configuration	'   ||||||  Required for Web.Config appSettings |||||

New Web.Config (partial code only, not the whole file)

<?xml version="1.0" encoding="utf-8"?> <configuration>  <!-- ||||| Application Settings ||||| -->  
   <appSettings> 
   [b]<add key="strConn" value="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;"/>[/b]  
  </appSettings> 
  <system.web>
  ...

And I just stated a notable change to the strConn in the web.config for SQL 7.0 or greater today.

The SQL Server .NET Data Provider allows you to connect to a Microsoft SQL Server 7.0 or 2000 database. For Microsoft SQL Server 6.5 or earlier, use the OLE DB .NET Data Provider with the "SQL Server OLE DB Provider" (SQLOLEDB).

Note: The SQL Server .NET Data Provider knows which data provider it is. Hence the "provider=" part of the connection string is not needed.

Hope this helps.

With a regards to basic errors like "something xyz is not declared", and as a means for the me better help everyone better, I would appreciate it if you try to investigate the errors you are getting a little better before posting them here. These are generally just a copy and pastee, coding or syntax error, and a fairly easy to fix once you review your code. Hard and fast rules of .Net Framework requires you to DECLARE all variables!

The SQL version of this is still being worked on, and I will have a step by step guide completed before long, just extremely busy at the moments building an Oracle based system and it is very time consuming.

But I will try to answer any questions you have on this thread or the new thread whenever I can. So keep the questions coming!

Happy coding

:cool:

I'm using SQLServer 7.0

My strConnection in web.config
<appSettings>
<add key="connString" value="server=myDBServer;uid=myid;pwd=myPass;database=myDB" />
</appSettings>

For SQL, I common out the Access thing, and use the syntax for SQL as you suggested:

' First is the Connection Object for an Access DB
' Dim MyConn As OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("connString"))

' This is the Connections Object for an SQL DB
SqlConnection(ConfigurationSettings.AppSettings("connString"))

and I got the error here saying that SqlConnection was not declared.
I thought the import we need for SQLServer is Imports System.Data.SqlClient
not Imports System.Data.OleDb

I just try to create my own member.db and run the sp_ValidateUser which can return 1 but the asp.net just always pass to the

Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"

when it reach the below statement
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)

Please help....

How do you know it is that line of code that is the source of the error? What is the error message.

See new link for the updated code!

New more details to solve your problem please!

I just try to create my own member.db and run the sp_ValidateUser which can return 1 but the asp.net just always pass to the

Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"

when it reach the below statement
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)

Please help....

Thanks for your help and being so patient with me. This is my very first attempt to work with .net so please excuse me for my dumb question. I'm still having a hard time to convert your code to work with SQL Server. Thanks.

Answer : LINK


Thanks for your help and being so patient with me. This is my very first attempt to work with .net so please excuse me for my dumb question. I'm still having a hard time to convert your code to work with SQL Server. Thanks.

Hello, i'm really new in this dot net. I would like to try the sample..
In the case cmdSubmit Button

FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page!

can i know how the login been authenticate in the default.aspx page?
thank u for your generous help..

It is not being authenticated in the Default.aspx page, it is being authenticated against the database, and the Redirect is sending the user on a successful login to the default.aspx page (which is the "default" page ASP.net sends you to following a RedirectFromLogin).

The function of the FormsAuthentication Class; RedirectFromLoginPage is overrided, and can accept 2 or 3 variables, depending on the one you are using. I am using the 2 arguement overrided function. Which excepts the userName as a String, and createPersistentCookie as a Boolean.

So I have passed the userName in via txtUserName.Text, and said False to creating a persistentCookie. This allows you to say set a greeting to the specific user, or whatever else you may want to do with this passed in value.

Hope this helps!

hi in your code u make a function but whats it s parameters plz mail me so i do it
i m new in asp.net

Ok, please be a little more specific.

Every function in the code takes a parameter, so what function are you refering to?

Function syntax: Function <name> (<parameters>)<return datatype of function>

Please BE MORE specific.

hi in your code u make a function but whats it s parameters plz mail me so i do it
i m new in asp.net

Paladine,

i'm also a relative newbie to asp.net, and i just wanted to thank you very much for your help! my login page worked perfectly thanks to your instructions.
heckman

hello
will is it possible to not give a response.redirect command to go other page
earlye

I am sorry but I do not understand what you are asking.


Ok? You don't want the user to go to next page on successful login? What is suppose to happen after login is completed? How would the user know where to go? If you mean another page other than default.aspx, I have to ask....have you reviewed the posts in this tutorial that speak of doing exactly that?


PLEASE be clear, specific and provide background information that may help me to help you get your questions answered

I think what he asked was:
Instead of
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page! ,
can he use, Reponse.Redirect

The answer is Yes. Response.Redirect will do the work.

Umm... ok. Thanks for answering that.

Yes!

yaa i want to do this but i want to redirect the user adminhome or userhom.aspx in your code it is possible that i define the particular page where a user go ?
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False)
at there how i define to go in next page just as userhome.aspx?

Well you can do this one of two ways. Use Response.Redirect("userhome.aspx") or you could add the userhome.aspx as a possible default page under IIS settings for the application directory that will contain your ASP.Net Application.

yaa i want to do this but i want to redirect the user adminhome or userhom.aspx in your code it is possible that i define the particular page where a user go ?
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False)
at there how i define to go in next page just as userhome.aspx?

hi but i dont knew how to set default property so if u have aby link then its good to me to understand it plz sand me that or describe it clearly ?

Ok no worries

Start Menu --> Control Panel --> Administrative Tools --> Internet Information Services.

Drill down in the cascading menu to the folder name holding your ASP.NET Application. Right click on that folder, select properties, then go to the documents tab

[img]http://www3.telus.net/public/tmlohnes/Image1.jpg[/img]
Click add and then type in the name and extension of the new default page you want to use instead of the listed ones.

Voila!

Excuse me I am a novice in asp.net and i prove to create a new alogin application wirh this code, but my page don't make any check on the table when I make the submit return all the time at the login page. i prove to enter correct data and wrong data can yiou help me please??? :sad: :sad:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.