Exception Handling declarative security

Discussion in 'ASP .Net Security' started by Patrick, Apr 23, 2004.

  1. Patrick

    Patrick Guest

    I'm reading myself into security and ASP.Net.

    I have written some demo code and now I'm wondering how you deal with
    exception handling when you use declarative security

    I have a method with the following attribute

    [PrincipalPermissionAttribute(SecurityAction.Demand, Name="Patrick")]
    private void MyFunction()
    {
    DoSomething().......
    }

    When I'm not athorized I will be redirected to a default errorpage.

    My question is what is the best way to handle. 1)Redirect to a
    customized errorpage or 2) is there a way to handle the exception so I
    can raise a user friendly message to my frontend.

    Thanks in advance

    gr Patrick
    Patrick, Apr 23, 2004
    #1
    1. Advertising

  2. Patrick

    Chris Rolon Guest

    You could subscribe to UnhandledException event handler on the current app
    domain. In that way you could return a friendlier message.

    Chris Rolon

    "Patrick" <> wrote in message
    news:...
    > I'm reading myself into security and ASP.Net.
    >
    > I have written some demo code and now I'm wondering how you deal with
    > exception handling when you use declarative security
    >
    > I have a method with the following attribute
    >
    > [PrincipalPermissionAttribute(SecurityAction.Demand, Name="Patrick")]
    > private void MyFunction()
    > {
    > DoSomething().......
    > }
    >
    > When I'm not athorized I will be redirected to a default errorpage.
    >
    > My question is what is the best way to handle. 1)Redirect to a
    > customized errorpage or 2) is there a way to handle the exception so I
    > can raise a user friendly message to my frontend.
    >
    > Thanks in advance
    >
    > gr Patrick
    Chris Rolon, Apr 25, 2004
    #2
    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. MS Newsgroups

    Declarative Security in ASP .net

    MS Newsgroups, Oct 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    436
    Natty Gur
    Oct 19, 2003
  2. Alexandre Poitras
    Replies:
    0
    Views:
    475
    Alexandre Poitras
    Oct 28, 2005
  3. marwis1978
    Replies:
    0
    Views:
    349
    marwis1978
    Mar 20, 2007
  4. MS Newsgroups

    Declarative Security in ASP .net

    MS Newsgroups, Oct 17, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    115
    MS Newsgroups
    Oct 17, 2003
  5. mpaine

    Declarative event handling from usercontrol

    mpaine, Sep 30, 2009, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    793
    mpaine
    Sep 30, 2009
Loading...

Share This Page