Manually authorize user

B

Brian Vallelunga

Is there any way, from an asp.net page to find out if a user is allowed
to view some random path based upon their credentials? Obviously this
gets done automatically in the UrlAuthorizationModule, but I have a
need to check an authorization from a page. Yeah, it's a bit weird, but
is it doable?

Basically, what I want is something like:

bool IsUserAllowedAccess(path, user)

Thanks,

Brian
 
G

Guest

Hello Brian,

I'm not sure I understand the requirement of not using the
UrlAuthorizationModule. Couldn't you put the following code in your page to
determine if the current user has access to the resource in the virtual path
parameter using the built-in UrlAuthorizationModule class?

if (UrlAuthorizationModule.CheckUrlAccessForPrincipal("~/BlogIt.aspx", User,
"get"))
{
Label1.Text = "You may blog";
}
 
B

Brian Vallelunga

You understood the requirements just fine. The
CheckUrlAccessForPrincipal was exactly what I needed. I just didn't
know it existed. That solved my problem perfectly. Thanks!

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top