Solved

How to auto login to a website from within an asp.net page

Posted on 2008-10-15
9
769 Views
Last Modified: 2012-05-05
I have an application that looks up (in a database) a user's name and password. I want to create a link to a know URL (always the same URL) that passes the user's login information (username and password) to the site and the given URL and logs them in. Is there a way to do this in asp.net?
0
Comment
Question by:freedom22
  • 4
  • 3
9 Comments
 
LVL 6

Expert Comment

by:pwrBall
ID: 22724951
Is the site you are passing them to a site that you manage as well?
0
 

Author Comment

by:freedom22
ID: 22725036
Yes, it is a site that I manage.
Users go to the URL, enter a username and password and click Submit.

Thanks
mark
0
 
LVL 6

Expert Comment

by:pwrBall
ID: 22726024
If both sites are ASP .NET sites, it should be doable.

When the user logs into the first site, you could store their username and password in the Session object, thus dynamically creating the query string of the URL you are speaking of by reading the Session object and obtaining the username and password.  Then once they click the link, the site they go to would have code in the Page Load that would read the query string and log the user in.  

If I were to do something like that though, I would probably write some little encryption/decryption scheme, so that the users information is not exposed for all to see in the URL you are passing.  And once you reach the other site, the password would be decrypted.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:freedom22
ID: 22727161
Hi pwrBall,

Thanks for your comments. It might be a little simpler. The username and password that I want to send along with the URL to the new site are NOT the username and password used to login to the original site. They are harvested from a database that I am searching in the first site. So I have the username and password in the details view control. The question is how to use those fields (that i have in the Details View) to login to the next site.

Hopefully I don't have to use a querysting attached to the URL?

Mark
0
 
LVL 6

Expert Comment

by:pwrBall
ID: 22733503
I see.  Ok, well as long as you have access to get their username and password without them having to type it in, that should work.  Just the data from the details view.  Are you having issues on how to actually get the data from the details view and store it somewhere?

If you don't want to use the query string, you could use Cookies.  

Here's some info on them:
http://msdn.microsoft.com/en-us/library/ms178193.aspx


0
 

Author Comment

by:freedom22
ID: 22733671
Hi pwrBall,

Thanks for your message. Yes, I don't know how to get the username and password from the DetailsView page and then use it to login to the new URL.

Thanks
mark
0
 
LVL 6

Accepted Solution

by:
pwrBall earned 500 total points
ID: 22733855
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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