Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have written the code to check user is authenticate or not, Also I want to check that particular session is expired or not, When I call my Web Method from Jquery ajax, the method return whole page object source in success function of ajax.

I am using HttpContext.Current.User......... class to check session and Identity of user.

Any idea how to get only value of Identity and session object?

Thanks
Posted
Comments
bbirajdar 28-Jun-13 5:05am    
Are you sure you get HttpContext.Current.User in a webmethod ?
Imran Khan Pathan 28-Jun-13 7:50am    
JavaScriptSerializer js = new JavaScriptSerializer();
bool isAuthenticate = HttpContext.Current.User.Identity.IsAuthenticated;
bool hasSession = Sessions.LoginID != null; // internally used HttpContext.Current.Session["SessionName"]
string result = js.Serialize(new { isAuthenticate = isAuthenticate, hasSession = hasSession });
return result;
Imran Khan Pathan 28-Jun-13 8:15am    
It was my mistake, My url like as "page.aspx?methodname" instead of "page.aspx/methodname".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900