views:

95

answers:

2

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

+1  A: 

I would go for User.Identity.IsAuthenticated

Henk
But the question was for authorization, not authentication.
Even Mien
A: 

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.

JustEngland
Very good. I think this is what I need. I just had to add a <location path=blah.ashx> tag in web.config to allow unauthenticated acesss to the .ashx file. Does anyone see any security issues with this if the .ashx file just returns true or false?
Aaron