Manually authorize user

Discussion in 'ASP .Net' started by Brian Vallelunga, Jul 27, 2006.

  1. 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
    Brian Vallelunga, Jul 27, 2006
    #1
    1. Advertising

  2. 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";
    }
    --
    brians
    http://www.limbertech.com


    "Brian Vallelunga" wrote:

    > 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
    >
    >
    =?Utf-8?B?YnJpYW5zW01DU0Rd?=, Jul 27, 2006
    #2
    1. Advertising

  3. 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

    brians wrote:
    > 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";
    > }
    > --
    > brians
    > http://www.limbertech.com
    >
    >
    > "Brian Vallelunga" wrote:
    >
    > > 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
    > >
    > >
    Brian Vallelunga, Jul 28, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmlsbCBCZWxsaXZlYXU=?=

    Authorize HTTPHeader

    =?Utf-8?B?QmlsbCBCZWxsaXZlYXU=?=, Dec 12, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,760
    =?Utf-8?B?QmlsbCBCZWxsaXZlYXU=?=
    Dec 15, 2003
  2. Ben Chen
    Replies:
    1
    Views:
    338
    =?Utf-8?B?UHJhdmVlbiBL?=
    Oct 11, 2004
  3. Blue

    Problem with Authorize.net

    Blue, Dec 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,159
    Chris Gunn
    Dec 30, 2005
  4. =?Utf-8?B?TWF0dEJlbGw=?=

    Forcing An Authorize in Forms Authentication

    =?Utf-8?B?TWF0dEJlbGw=?=, Jul 7, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    317
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 7, 2006
  5. Nixon

    Protect / Authorize urls.

    Nixon, Nov 15, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    261
    Nixon
    Nov 15, 2006
Loading...

Share This Page