Forms Authentication [Resolved]

Posted by hareeshkumarkr-16190 under ASP.NET on 7/23/2012 | Points: 10 | Views : 909 | Status : [Member] | Replies : 6
hi

I have a page called Login.aspx that handles login it takes username, pass and
compares to a database. If the user is authenticated then i want to redirect to another page with session value
if seesion expired i want to redirect back to login page

how to handle this using forms authentication method


help me




Responses

Posted by: hareeshkumarkr-16190 on: 7/24/2012 [Member] Starter | Points: 25

Up
0
Down

Resolved
Thank You all.....

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 7/23/2012 [Member] Starter | Points: 25

Up
0
Down
Add the below code in web.config

<authentication mode="Forms">

<forms loginUrl="~/Login.aspx" defaultUrl="~/Menu.aspx" timeout="30" slidingExpiration="true"/>
</authentication>


Codebehind.

Use the following code to check timeout.

Use a separate function or an if loop for checking that.

Session(Login.SessionCheckKey) 


Hope This Helps You


____________
www.flickr.com/photos/psdesigner/

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/23/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Refer this url

http://msdn.microsoft.com/en-us/library/ms178581.aspx

.

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/23/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
@Ranjeet_8

Your answer is not related to the question , please post answers related to the question.

Thank you for posting at Dotnetfunda
[Administrator]

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/23/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
   ChekValidate = Check_Your_Login(txtUID.Text.trim(), txtPwd.Text.trim());

if (ChekValidate == 1)
{
Session["Login"] = Your_Session_Var;
// Redirect to Secure page
}
else
{
lblMsg.Text = "Invalid Uid / Pwd.!!!";

}

// Check User is Validate or Not

if (Session["Login"] == null) {
// Redirect to Logout Page.
}


hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/23/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
@Ranjeet_8

Thanks


Thank you for posting at Dotnetfunda
[Administrator]

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response