|
-
Oct 13th, 2010, 02:58 PM
#1
FormsAuthentication with my own DB - get logged on user
Hi,
First of all, I'm very new to ASP.NET (though not .NET in general), so my apologies if something is obvious... It's not for me 
I am trying to build a simple login system in my website. I did some searching and found that there are quite a few 'templates' (such as the Login controls) that Visual Studio provides for you. However, by default those need a MS SQL Server database. This is a problem for me because
1. I don't have a MS SQL database,
2. My webspace provider does support it, but only for an additional fee, and I feel paying an additional fee just for a simple login system is... no.
3. I'd like to keep it all in my existing (Access) database.
I came across this website which shows me how to handle the login system with an Access database.
As far as I can tell all I need is the username and then I can get all the built-in login controls and such working.
So, I implemented this, and it seems to work fine. I can login using the Login control, I can display or hide content whether or not the user is logged in using the LoginView control, I can display a Login / Logout link, etc.
The only thing I cannot seem to do is get the name of the currently logged in user (if any). All I need is the name, I can get the rest via the database manually that's no problem.
There is the LoginName control which displays that name to me, but I cannot figure out how to retrieve it in code.
I did found the Membership.GetUser() method, but it doesn't seem to work (because I'm using my own Access database? I dunno), it returns Nothing even if a user is logged in (the LoginName control shows the name).
How can I do this..? Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|