GetCompiledPageInstance and Medium trust application level

Discussion in 'ASP .Net Security' started by Ondrej Valenta, Jun 28, 2006.

  1. Hi,
    is there any way how to go through this Security exception when using GetCompiledPageInstance method in Medium trust app level (webhosting environment)? Where is the real problem? I mean why application has to be in Full trust?

    I'm using that method because RewritePath has serious problem - is not changing server variables - and because is the best way how to solve SEO friendly urls.

    Please answer as soon as possible
    BR,
    Ondrej Valenta
    Web Developer and Microsoft Fan ;-)
    Security Exception
    Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

    Exception Details: System.Security.SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

    Source Error:

    Line 75: }
    Line 76:
    Line 77: return PageParser.GetCompiledPageInstance("/index.aspx",context.Server.MapPath("/index.aspx"),context);
    Line 78: // TODO: Add RewriteUrlHandler.GetHandler implementation
    Line 79: return null;
     
    Ondrej Valenta, Jun 28, 2006
    #1
    1. Advertising

  2. Hi,

    you need unrestricted security permission:

    [SecurityPermission(SecurityAction.Demand, Unrestricted=true)]
    public static IHttpHandler GetCompiledPageInstance(string virtualPath, string
    inputFile, HttpContext context)
    {}


    i just think MS does not want partially trusted code to do that low-level
    stuff.


    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Hi,
    > is there any way how to go through this Security exception when using
    > GetCompiledPageInstance method in Medium trust app level (webhosting
    > environment)? Where is the real problem? I mean why application has to
    > be in Full trust?
    > I'm using that method because RewritePath has serious problem - is not
    > changing server variables - and because is the best way how to solve
    > SEO friendly urls.
    >
    > Please answer as soon as possible
    > BR,
    > Ondrej Valenta
    > Web Developer and Microsoft Fan ;-)
    > Security Exception
    > Description: The application attempted to perform an operation not
    > allowed by the security policy. To grant this application the required
    > permission please contact your system administrator or change the
    > application's trust level in the configuration file.
    > Exception Details: System.Security.SecurityException: Request for the
    > permission of type System.Security.Permissions.SecurityPermission,
    > mscorlib, Version=1.0.5000.0, Culture=neutral,
    > PublicKeyToken=b77a5c561934e089 failed.
    >
    > Source Error:
    >
    > Line 75: }
    > Line 76:
    > Line 77: return
    > PageParser.GetCompiledPageInstance("/index.aspx",context.Server.MapPat
    > h("
    > /index.aspx"),context);
    > Line 78: // TODO: Add RewriteUrlHandler.GetHandler implementation
    > Line 79: return null;
     
    Dominick Baier [DevelopMentor], Jun 28, 2006
    #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. Paul Hatcher

    Medium Level Trust and Reflection

    Paul Hatcher, Feb 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    503
    Paul Hatcher
    Feb 25, 2005
  2. Andy
    Replies:
    1
    Views:
    362
  3. Steven Voordijk

    Marshal.Copy (in medium trust level environment)

    Steven Voordijk, Jan 16, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    737
    Alvin Bruney [ASP.NET MVP]
    Jan 19, 2008
  4. Linda
    Replies:
    1
    Views:
    562
    Dominick Baier
    Aug 31, 2006
  5. Shahar Nechmad

    EnterpriseLibrary.Security and medium trust level

    Shahar Nechmad, Oct 18, 2006, in forum: ASP .Net Security
    Replies:
    0
    Views:
    177
    Shahar Nechmad
    Oct 18, 2006
Loading...

Share This Page