.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

auto login concept

Posted By: Nabin     Posted Date: February 04, 2010    Points:2   Category :ASP.Net
hello frnds
there are two sites like gmail and orkut. as like suppose we r logged in on gmail and gmail is already registered to orkut then if we click the link orkut from gmail then we can automatically log in to orkut, it can access the id and password from gmail and logged in to our orkut account automatically. so wht the concept behind that and how will be the code written in asp.net.

Please help any one its urgent.

Thanks & Regards

Author: Arial             
Posted Date: February 04, 2010     Points: 5   

Make use of Session variable to maintain user login.

Author: Nabin             
Posted Date: February 04, 2010     Points: 5   


Author: Arial             
Posted Date: February 04, 2010     Points: 5   

Hope this code help u

This example shows u how to handle session objects for login module.
it also shows how to create session values and to abort session on logout...

/for SignIn
protected void btnSignIn_Click(object sender, System.EventArgs e)

f = new homePage();
DataSet dbSet = f.loadDatabase(Server.MapPath(strDatabase), "SELECT * FROM members WHERE username ='" + txtUsername.Text + "'"); // new DataSet();
bool boolSuccess = false;

if (dbSet != null)
foreach (DataRow dbRow in dbSet.Tables[0].Rows)
if (Convert.ToString(dbRow["pass"])) == txtPassword.Text)
liMessage.Text = "Login Successfully
// Logged in?
Session["LoggedIn"] = true;
Session.Timeout = 60;
// User info
Session["User_Name"] = dbRow["username"];
Session["UserID"] = dbRow["usrid"];
Session["User_Email"] = dbRow["mail"];
Session["User_Info"] = dbRow["usrdescription"];
Session["admin"] = dbRow["admin"];
Session["su"] = dbRow["superuser"];
Session["User_SignupDate"] = dbRow["signupdate"];
Session["User_LastIP"] = dbRow["ipaddr"];
Session["User_LastLogin"] = dbRow["lastlogindate"];
boolSuccess = true;


liMessage.Text = "There was an error while accessing the database.
Please try agian later.";
// for signOut
protected void btnSignOut_Click(object sender, System.EventArgs e)

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend