Extremely freaky Security Exception

Discussion in 'ASP .Net Security' started by William Sullivan, Aug 17, 2005.

  1. I have a page that (simply put) displays information from a SQL database.
    I've split off the business logic and database access logic into different
    classes. My database access class exposes static methods for loading typed
    datasets with information from the database. I call methods in this class
    three times when my page loads. The first two methods I call work fine; they
    return the data I expect from the database. The last method fails with a
    Security Exception. The extremely freaky part is that when I follow the
    execution while debugging, the exception is thrown exactly when I call the
    method. Execution never enters the method. A snippet of code looks like:

    this.securityData = DBHelper.GetSecurityData();

    this.roomData = DBHelper.GetRoomData(this.userID);

    CabinetData foo = DBHelper.GetCabinetData(roomServer, roomDbName, dbType);

    the three methods do pretty much the same thing--connect to the database,
    run a query, fill a typed dataset with the results, and return it. The only
    difference is that the first two are instance variables, the third (foo) is a
    local variable to the method where the calls occur. The exception is thrown
    after the third line is reached and before stepping into the method. I want
    to make this clear--the method GetCabinetData never executes; the exception
    is thrown at the point where execution would normally transfer from the
    calling method into GetCabinetData. I'm stumped. TIA.
    William Sullivan, Aug 17, 2005
    #1
    1. Advertising

  2. I caught the security exception, and the RefusedSet is
    " [snip]Flags=\"UnmanagedCode\"[snip]

    I never requested to run unmanaged code. I don't run unmanaged code. What
    the heck is going on?

    "William Sullivan" wrote:

    > I have a page that (simply put) displays information from a SQL database.
    > I've split off the business logic and database access logic into different
    > classes. My database access class exposes static methods for loading typed
    > datasets with information from the database. I call methods in this class
    > three times when my page loads. The first two methods I call work fine; they
    > return the data I expect from the database. The last method fails with a
    > Security Exception. The extremely freaky part is that when I follow the
    > execution while debugging, the exception is thrown exactly when I call the
    > method. Execution never enters the method. A snippet of code looks like:
    >
    > this.securityData = DBHelper.GetSecurityData();
    >
    > this.roomData = DBHelper.GetRoomData(this.userID);
    >
    > CabinetData foo = DBHelper.GetCabinetData(roomServer, roomDbName, dbType);
    >
    > the three methods do pretty much the same thing--connect to the database,
    > run a query, fill a typed dataset with the results, and return it. The only
    > difference is that the first two are instance variables, the third (foo) is a
    > local variable to the method where the calls occur. The exception is thrown
    > after the third line is reached and before stepping into the method. I want
    > to make this clear--the method GetCabinetData never executes; the exception
    > is thrown at the point where execution would normally transfer from the
    > calling method into GetCabinetData. I'm stumped. TIA.
    William Sullivan, Aug 17, 2005
    #2
    1. Advertising

  3. Lesson: Never put anything in your code that you do not fully understand.
    Even if FxCop tells you to.

    [assembly:SecurityPermission(SecurityAction.RequestRefuse,
    UnmanagedCode=true)]

    "William Sullivan" wrote:

    > I have a page that (simply put) displays information from a SQL database.
    > I've split off the business logic and database access logic into different
    > classes. My database access class exposes static methods for loading typed
    > datasets with information from the database. I call methods in this class
    > three times when my page loads. The first two methods I call work fine; they
    > return the data I expect from the database. The last method fails with a
    > Security Exception. The extremely freaky part is that when I follow the
    > execution while debugging, the exception is thrown exactly when I call the
    > method. Execution never enters the method. A snippet of code looks like:
    >
    > this.securityData = DBHelper.GetSecurityData();
    >
    > this.roomData = DBHelper.GetRoomData(this.userID);
    >
    > CabinetData foo = DBHelper.GetCabinetData(roomServer, roomDbName, dbType);
    >
    > the three methods do pretty much the same thing--connect to the database,
    > run a query, fill a typed dataset with the results, and return it. The only
    > difference is that the first two are instance variables, the third (foo) is a
    > local variable to the method where the calls occur. The exception is thrown
    > after the third line is reached and before stepping into the method. I want
    > to make this clear--the method GetCabinetData never executes; the exception
    > is thrown at the point where execution would normally transfer from the
    > calling method into GetCabinetData. I'm stumped. TIA.
    William Sullivan, Aug 18, 2005
    #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. mikester
    Replies:
    7
    Views:
    595
    mikester
    Dec 25, 2003
  2. B Dunwoodie

    ASP.NET/IIS on XP Pro Extremely SLOW

    B Dunwoodie, Apr 26, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    484
    B Dunwoodie
    Apr 26, 2004
  3. Jon   Paal
    Replies:
    2
    Views:
    406
    Jon Paal
    Jan 17, 2007
  4. Reckoner
    Replies:
    4
    Views:
    337
    Gary Herron
    Jul 28, 2009
  5. Nick Grandy

    workings of the freaky freaky sandbox

    Nick Grandy, May 3, 2008, in forum: Ruby
    Replies:
    0
    Views:
    109
    Nick Grandy
    May 3, 2008
Loading...

Share This Page