473,789 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Authentication help.

Hi all

I am new to asp.net. I want to implement authentication in all pages.
What i want to do is validate user from database table. So currently
what i am doing is on login page validating user and storing valid
user id in sesstion.

On every page i am checking userid from session.. But i don't want to
behavirour. what i want is to provide authentication to all pages
once not on every page .

So how will i do this. And if session expire in between what will
happen if user try to access the page after that.

Please correct me if i am wrong in any concept.

thanks in advance.

Oct 22 '07 #1
5 1325

You need an authentication section in the web.config, once the user has
authenticated then they will be able to access your pages.
"archana" <tr************ **@yahoo.comwro te in message
news:11******** **************@ i13g2000prf.goo glegroups.com.. .
Hi all

I am new to asp.net. I want to implement authentication in all pages.
What i want to do is validate user from database table. So currently
what i am doing is on login page validating user and storing valid
user id in sesstion.

On every page i am checking userid from session.. But i don't want to
behavirour. what i want is to provide authentication to all pages
once not on every page .

So how will i do this. And if session expire in between what will
happen if user try to access the page after that.

Please correct me if i am wrong in any concept.

thanks in advance.

Oct 22 '07 #2
Hi,

thanks for reply.
but what authentication do i need to use as i have to validate
username in database.

So how will i combine this with form/windows authentication?

please help me asap.

thanks.

Oct 22 '07 #3
Your best bet is to use A Membership or Role Provider and Forms
Authentication in your application. The Provider Model is built in to the
ASP.Net Framework, can work from a custom database back-end, and manages
permissions across the web application in a uniform, easy to maintain
manner. In addition, it can be combined with XML Site Maps for
login-specific menuing that is handled automatically. See the following
references:

http://msdn2.microsoft.com/en-us/library/aa479030.aspx
http://msdn2.microsoft.com/en-us/library/aa530801.aspx
http://msdn2.microsoft.com/en-us/library/aa478958.aspx

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"archana" <tr************ **@yahoo.comwro te in message
news:11******** **************@ v29g2000prd.goo glegroups.com.. .
Hi,

thanks for reply.
but what authentication do i need to use as i have to validate
username in database.

So how will i combine this with form/windows authentication?

please help me asap.

thanks.

Oct 22 '07 #4
On 22 Oct, 06:16, archana <trialproduct2. ..@yahoo.comwro te:
Hi all

I am new to asp.net. I want to implement authentication in all pages.
What i want to do is validate user from database table. So currently
what i am doing is on login page validating user and storing valid
user id in sesstion.

On every page i am checking userid from session.. But i don't want to
behavirour. what i want is to provide authentication to all pages
once not on every page .

So how will i do this. And if session expire in between what will
happen if user try to access the page after that.

Please correct me if i am wrong in any concept.

thanks in advance.
No need to keep checking the session. For example with forms
authentificatio n:

(1) Include a forms authentificatio n entry something like the one
below:

<authenticati on mode="Forms">
<forms name="mydomain" loginUrl="~/Default.aspx" defaultUrl="~/
News/News.aspx" protection="All " cookieless="Aut oDetect"
slidingExpirati on="true" timeout="30"/>
</authentication>

The forms authentificatio n entry above allows users with a good cookie
set to go straight to the "~/News/News.aspx", the defaultUrl. Users
whose cookies fail authentificatio n will land at the login page (see
(4) below).

(2) You may need to edit your machineKey entry too, so that you can
deal with encrypted cookies, etc.:

<machineKey decryption="AES " validation="SHA 1"
decryptionKey=" _____,IsolateAp ps" validationKey=" _____,IsolateAp ps"/>

The underlined bits in the above code are where you put your keys.
These are big hexadecimal numbers.

(3) Each area of the site needs to be told what sorts of users are
allowed to visit those pages. In the entry below, all files inside the
Administration directory are being made available to users who are in
any one of 4 mwAdmin_ roles: Super,Editor,De mo,Full. These roles are
just some text which I store in the user's encrypted cookie.

<location path="Administr ation">
<system.web>
<authorizatio n>
<allow
roles="mwAdmin_ Super,mwAdmin_E ditor,mwAdmin_D emo,mwAdmin_Ful l"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

You will need a separate entry like this for each individual page in
your root but only one entry is needed for directories containing
files provided that the files within a subdirectory have the same
security settings.

(4) The process of checking whether your visitors have their cookies
set is done in Global.asax, in the
FormsAuthentica tion_OnAuthenti cate() event - which you may need to
add. In general, I (a) read their cookie and get their ticket. (b) I
get their userID from the ticket, (c) then look up the database to get
their roles and the period for which their cookie remains valid. (d)
make the user:
User user = new User(Ticket.Nam e, strRoles, PersistentCooki eDays,
iLoginId);
I then write this information to a new ticket and store it back to
their cookie. (e) If they're an authentic user I add their userID to
the their security Context. Google to find some examples.
Oct 22 '07 #5
On 22 Oct, 15:19, mark4asp <mark4...@gmail .comwrote:
On 22 Oct, 06:16, archana <trialproduct2. ..@yahoo.comwro te:
Hi all
I am new to asp.net. I want to implement authentication in all pages.
Ooops I forgot, check out: <http://forums.asp.net/thread/1177390.aspx>
for FormsAuthentica tion_OnAuthenti cate() event.

Oct 22 '07 #6

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

Similar topics

8
3709
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no boxes come up. I want an ASP page to sit between the user and the ISAPI application. The rest of my application is using authentication that is database driven and wouldn't want the users to know the userid and password. Is this possible? If so...
6
4841
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms Authentication set up and it worked just fine. Then I realized that I needed to have some pages unsecure. I then created 2 directories. One named Secure and the other named Public. I placed my web.config file in my
4
662
by: David Moore | last post by:
Hello I am using the System.DirectoryServices namespace classes to access Active Directory. We connect using the LDAP://DOMAIN method. The code works on local dev boxes, and in staging, but doesn't work on a particular box in our production environment. When we try to connect and do a search, we get a "The authentication mechanism is unknown" error. I have searched on Google, Microsoft Support Knowledge Base and Yahoo etc, and found this...
8
1975
by: tcg_gilbert | last post by:
I'm developing a web application for our local intranet that will allow users to pull up a webpage and update or deleted or insert records into a database as well as run reports etc... Our DB server is on a Win2k3 OS using SQL Server 2000 Our Web server is on a separate Win2kr OS using IIS 6 Both the servers and the clients are part of the same domain. We've turned anonymous access off on the web and are passing the integrated...
4
6808
by: Andrew | last post by:
Hey all, I would like to preface my question by stating I am still learning ASP.net and while I am confident in the basics and foundation, the more advanced stuff is still a challenge. Ok. :)
3
2502
by: Stephanie Stowe | last post by:
I am new to ASP.NET having come from ASP classic background. I need to understand authentication. I have a server running IIS which contains an ASP.NET app. On IIS the app has both anonymous and Windows Integrated Authentication enabled. In the ASP.NET app, the web.config file contains <authentication mode="Windows" /> The help on this element says of this setting Specifies Windows authentication as the default authentication mode....
6
3349
by: Ming Zhang | last post by:
Hi guys, I have couple of ASP.NET applications that only support digest windows authentication, and credentials are managed in a central AD. When users login to one app, they can easily navigate to other apps without reenter UID/PWD. Everything works except it doesn't meet our security policy for new created users. When creating a new user, it's required to have "user must change password when first time login". In this case, the user will...
2
1540
by: Bruce Groen | last post by:
I am having some authentication issues. I download a sample app to test the forms based authentication process of asp.net and it works on one of my servers but not the other one. The one that it is not working on is my production server and has OWA, CRM, Sharepoint, etc. Most everything is configured to require windows authentication and use https but for this one test folder, I changed it to not use https and to allow anonymous access....
10
4066
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to Pop up windows Authentication box so that user will give his userId, Password & domain name for authenticaion. After that I want to take these three info of user and make a search in Active Directory.
5
3568
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the creation of content which adjusts based on the user. I have several pages which require a user to be logged on and several which do not. Prior to this point in time I have used 2 different master pages. one with a control which checks a session...
0
9663
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
9506
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,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
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
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6761
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
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
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

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.