473,598 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Concept behind ASP.NET user LOGIN application?

im migrating from asp to asp.net. im a bit confused about form
authentication in ASP.NET ...

in ASP if I wanted to create a login application I would simply query the db
for the username and password entered in a form and if a count of 1 was
returned i would set cookies and redirect and so on.

I could do this in ASP.NET, but is this what is supposed to be done? because
in my ASP.NET unleashed book I dont see any examples of a login app except
an entire chapter on form authentication and its a little confusing.

What is the most proper concept behind creating a login in ASP.NET?

thanks
omar
Nov 17 '05 #1
5 6450
Jos
omar wrote:
im migrating from asp to asp.net. im a bit confused about form
authentication in ASP.NET ...

in ASP if I wanted to create a login application I would simply query
the db for the username and password entered in a form and if a count
of 1 was returned i would set cookies and redirect and so on.

I could do this in ASP.NET, but is this what is supposed to be done?
because in my ASP.NET unleashed book I dont see any examples of a
login app except an entire chapter on form authentication and its a
little confusing.

What is the most proper concept behind creating a login in ASP.NET?


Logging in is a process that has 2 parts: authentication (who is logging
in?)
and authorization (what is this person allowed to do?).

ASP.NET can take care of the authorization part with the aid of
configuration files. The idea is to indicate in web.config who
has which rights to a certain folder. No more code is needed.
If the user is not yet logged in, he or she is redirected to a login
page automatically.

The only thing you still have to do is make the login page and do
the authentication, but there are a few useful functions in ASP.NET
that make it very easy, such as:
FormsAuthentica tion.RedirectFr omLoginPage.

--

Jos
Nov 17 '05 #2
Omar,
What u r doing also can be implemented in .net, But not many want to do
that, What u can do is Check the DB for Login and password and set up a
session just like the classical ASP.
If u want an example let me know I have one.
Regards
Khan Imran
"omar" <om****@REMOVEo ptonline.net> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
thanks,
but what about when your users are stored in a database and you want to give access to certain pages not folders necessarily.

In asp we would create a session or cookie upon login and give access to a
page by seeing if the session or cookie existed. is this not really the
proper way in asp.net?

thank you
omar

Nov 17 '05 #3
Omar,
What u r doing also can be implemented in .net, But not many want to do
that, What u can do is Check the DB for Login and password and set up a
session just like the classical ASP.
If u want an example let me know I have one.
Regards
Khan Imran
"omar" <om****@REMOVEo ptonline.net> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
thanks,
but what about when your users are stored in a database and you want to give access to certain pages not folders necessarily.

In asp we would create a session or cookie upon login and give access to a
page by seeing if the session or cookie existed. is this not really the
proper way in asp.net?

thank you
omar

Nov 17 '05 #4
Hey Omar, I ran in to the same thing the first time I
wanted to move from a classic ASP solution to ASP.NET.
There's some really cool functionality and some decent
examples out there. Here's one I created just to show
some possible configuration settings in the web.config
file:

http://www.simpleasp.net/DesktopDefault.aspx?tabid=42

This example is using Forms based Authentication and URL
based Authorization.

Another good basic example is here:

http://www.15seconds.com/issue/020220.htm

In my simple example, I put the user name and password in
the config file. Not something I'd do in a production
app. You can use your login page to verify the user name
and password against a database like you are doing now in
ASP. Once you do this, you can use the methods exposed by
the FormsAuthentica tion class to set an authentication
cookie (note that ASP.NET does all the cookie work for
you. You don't have to write any code).

Good luck!
-----Original Message-----
"Khan Imran" <im*******@htmt .soft.net> wrote in message
news:uu******* *******@TK2MSFT NGP12.phx.gbl.. .
Omar,
What u r doing also can be implemented in .net, But not many want to do that, What u can do is Check the DB for Login and password and set up a session just like the classical ASP.
thanks khan, when u say "What u r doing also can be

implemented in .net, Butnot many want to do that" are you referring to doing it the classical ASPway, checking the db and setting sessions?

thank you,
omar
.

Nov 17 '05 #5
Hey Omar, I ran in to the same thing the first time I
wanted to move from a classic ASP solution to ASP.NET.
There's some really cool functionality and some decent
examples out there. Here's one I created just to show
some possible configuration settings in the web.config
file:

http://www.simpleasp.net/DesktopDefault.aspx?tabid=42

This example is using Forms based Authentication and URL
based Authorization.

Another good basic example is here:

http://www.15seconds.com/issue/020220.htm

In my simple example, I put the user name and password in
the config file. Not something I'd do in a production
app. You can use your login page to verify the user name
and password against a database like you are doing now in
ASP. Once you do this, you can use the methods exposed by
the FormsAuthentica tion class to set an authentication
cookie (note that ASP.NET does all the cookie work for
you. You don't have to write any code).

Good luck!
-----Original Message-----
"Khan Imran" <im*******@htmt .soft.net> wrote in message
news:uu******* *******@TK2MSFT NGP12.phx.gbl.. .
Omar,
What u r doing also can be implemented in .net, But not many want to do that, What u can do is Check the DB for Login and password and set up a session just like the classical ASP.
thanks khan, when u say "What u r doing also can be

implemented in .net, Butnot many want to do that" are you referring to doing it the classical ASPway, checking the db and setting sessions?

thank you,
omar
.

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3556
by: Tom | last post by:
Hi I have a web application using asp.net and c#. User has to login to the application with his username and pwd. However, I do not allow other user uses the same username and pwd to login, i.e. one set of login ID cannot be used for twice except the logged in user's session has expired or he exited the system and terminate the session (Session.Clear();). Here is the C# code in my login cs file = obj; //I created a session here after...
1
702
by: omar | last post by:
im migrating from asp to asp.net. im a bit confused about form authentication in ASP.NET ... in ASP if I wanted to create a login application I would simply query the db for the username and password entered in a form and if a count of 1 was returned i would set cookies and redirect and so on. I could do this in ASP.NET, but is this what is supposed to be done? because in my ASP.NET unleashed book I dont see any examples of a login app...
17
2686
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
3
2087
by: Don | last post by:
I'm using FROMS authentication and want to automate the login. Right now I force the user to manually log in. I would like to detect the users network userName and if they have an account I will automatically log them in. If they don't they wil be taken to the login page. I can get the network id of the user using System.Environment.UserName if I turn off anonymous access but this gived me an access denied error. If I turn on...
6
2427
by: Andrew Chalk | last post by:
My application attempts to connect to an SQL Server database as name ASPNET and Login Name SERVERNAME/ASPNET in response to these commands: SqlConnection myConnection = new SqlConnection("Data Source=(local);Initial Catalog=MCSCRE;Integrated Security=SSPI"); myConnection.Open(); However, the user of this database is ASPNET. I can't create a user ASPNET with a login name SERVERNAME/ASPNET, SQL Enterprise Manager always keeps the name...
0
1678
by: clintonG | last post by:
I applied aspnet_regsql to SQL2K which was working fine throughout Beta 2 development. After installing Visual Studio and SQL Express RTM my application has blown up. Logging in to the application became realllllllllllly slow. Content in LoginView Role Groups was not displaying even after a user in a role had logged in. It was taking about 15 seconds or so for the login control to display when the login link was selected on the homepage....
21
3051
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different computers (running different browsers, logged in as different users, etc.). My web site keeps track of users logged in through the use of $_SESSION. Here's the bizarre thing: All computers are logged off, then I log into my web site with one...
6
5661
by: MuZZy | last post by:
Hi, I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. For example, when i log in to my laptop from home, I'm not on the office network so i can't reach AD but I'm sure i still can get my AD's objectGUID, as the profile is cached locally. Any ideas?
8
6325
by: Brett | last post by:
I wrote an ASP.NET application that queries a SQL Server database (on a different box from the web server) and displays the result in a GridView. The datasource for the GridView is a SQLDataSource. Just to get it to work, I hard-coded the username and password of a SQL Server account in the connectionstring in web.config. Once I confirmed that this worked on the web server, I wanted to remove the hard-coded password from web.config, so I...
5
2535
by: Mr. X. | last post by:
Hello. In Visual Studio 2008, there is on the toolbox -login -login, which create a login form. On that form there is a LoginButton, which click on it is evented on the "default.aspx.vb" codeBehind. How can I use the value on the codeBehind (default.aspx.vb) of UserName &
0
7981
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2410
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.