Solved

How can I use a username / password that i've created in a sql database and carry that throughout my asp.net (vb) application

Posted on 2007-11-18
5
190 Views
Last Modified: 2010-04-06
I am running into the following problem with my asp.net (vb) app:

I have created a SQL Database for my one applictaion that i'm working on, this database houses all of the login information for this particluar application ( name's, info, and then a username / password tied to them).  I have created a logon page for my asp.net application.  from that login page I want to be able to capture the USERNAME and PASSWORD which is entered to get into the application and have it attched to the user when they are using the application.  

For example:

I log into the application at the logon page (which is the first screen that appears).  my logon name is rboyle.  Once I am redirected to the next page I want to be able to reference that it is rboyle that is logged into the application so that I can reference that on particular parameter and pull up different information from the database based off it.  How can I do this?  If anyone has any ideas / suggestions / and / or any sample code that would be great.    
0
Comment
Question by:CPGHelpDesk
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:anoyes
ID: 20308734
I assume that you are able to log in properly.  You can use User.Identity.Name to get the username of the currently logged in user.  So for example if you had a label Label1 that you wanted to display the username, just use Label1.Text = User.Identity.Name

Hope this helps!
0
 

Author Comment

by:CPGHelpDesk
ID: 20309316
no i'm not able to log in properly yet:

1. I want to tie the application into my SQL 05 database that i've built for this project.  Get the username / password from the user's records w/n the database (so i'm not interacting w/ my AD at all).  

2.  After verifying who has logged in I want to carry that value from the logon page throughout the rest of the application.  Reason for this is the info I need to process w/n the application is based on what user is logged into the app.  

any examples / help  that you guys can give me would be great.  

best regards,

ryan
0
 
LVL 16

Accepted Solution

by:
anoyes earned 500 total points
ID: 20309333
Ah, ok.  What you are most likely going to need to do is build a custom membership provider.  You could use the built in provider, but that would mean that you'd have to rework your database, which generally isn't really a solution at all.  The reason you have to do this is that the tables/fields in your DB won't match up with what the built-in .NET membership provider is expecting.  Here are some good tutorials that got me started with custom membership providers.  Hopefully they can get you off to a good start too:

http://msdn2.microsoft.com/en-us/library/ms366730(vs.80).aspx
http://www.devx.com/asp/Article/29256/0/page/

Let me know if you have questions.
0
 

Author Comment

by:CPGHelpDesk
ID: 20310354
to save time here is what i'm going to do..i'm going to hold off on the validation portion for right now.  

I need to be able to share a string varable accross multiple pages, how can i possibly do this.  

For example on my logon page i have current_user which is a string variable
I want to be able to get the value of this variable wherever i am in the application, can someone briefly describe how i go about doing this.  

thanks.  

ryan.
0
 
LVL 16

Assisted Solution

by:anoyes
anoyes earned 500 total points
ID: 20310392
Store it in a session variable.

Session("current_user")="blablabla" sets it, Response.Write(Session("current_user")) writes it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Could not load file or assembly 'Microsoft.Web.Infrastructure 4 41
Header Font Size in Grid View 6 25
Aspx calendar pop up control 3 28
asp.net web app 3 22
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question