Session send and retrieve using jquery

Posted by Klbaiju under ASP.NET on 9/19/2014 | Points: 10 | Views : 632 | Status : [Member] | Replies : 1
Hi,

in my application ,i want to send session using jquery and also check session using jqiuery

for example

var uname=$('#txtuname').val();

$.ajax({
type: "POST",
url: "WebService.asmx/Checklogin",
data: "{'uname':'" + uname + "','password':'" + password + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
//alert(msg.d);
if (msg.d == "Success") {
location.href = "Busdetails.aspx";

//set session here

Session["uname"]=uname;
}


}
});

*********************************

in busdetails.aspx i want to check session

how it is possible.

Regards

Baiju




Responses

Posted by: Sheonarayan on: 9/20/2014 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Dear Klbaiju,

Thanks for asking question. Checking for Session is not the right way to implement Login functionality, you can visit this link http://www.dotnetfunda.com/articles/show/114/forms-authentication-in-aspnet-with-csharp-basic to know how to do this correctly in ASP.NET.

To check whether user is logged in or not using jQuery, I have just now written an article for you that explains this; read this http://www.dotnetfunda.com/articles/show/2974/checking-for-logged-in-user-using-jquery-in-aspnet.

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response