Aaron
Aaron

Reputation: 433

Test for authentication from client using asp.net and ajax

From the client, is there a way to get a true/false value from an asp.net page to show you have authorization to access the page. Using Forms Authentication I get redirected to a login page. I just need a simple boolean.

Aaron

Upvotes: 1

Views: 193

Answers (2)

JustEngland
JustEngland

Reputation: 1391

All of these methods that are mentioned are Server Side Asp.net Calls. If you would want to do this from the client side I would create a Generic Handler to wrap the Page.User.IsInRole("YourRoleName") or System.Web.HttpContext.Current.User.IsInRole("YourRoleName") calls.

Then you could just use javascript to call the handler and return the result.

Upvotes: 0

Henk
Henk

Reputation: 704

I would go for User.Identity.IsAuthenticated

Upvotes: 1

Related Questions