Can't view project using Visual Studio 2008

Last post 02-05-2008 3:28 AM by rjcox. 5 replies.

Sort Posts:

  • Can't view project using Visual Studio 2008

    02-04-2008, 1:28 PM
    • Member
      10 point Member
    • .NET
    • Member since 01-03-2008, 2:00 PM
    • Posts 57

    Hi,

    I've recently installed Visual Studio 2008 and using VS I've opened a "website" folder on my computer so I can make some amends.

    The location of the folder on my computer is P:\Castle Point Business Forum\Website\cpbusinessforum.co.uk\

    But I've noticed that there is a problem viewing files in a browser using VS (e.g. it's own variation of localhost), where by all my fully functioning websites display the below error message. Can anyone please advise what might be causing this problem and how to resolve it. There is nothing special happening in my application, it doesn't use a database and is a straight forward simple ASP.NET 3.5 project?

    Many thanks.


    Server Error in '/cpbusinessforum.co.uk' Application.

    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.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
       System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
       System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +41
       System.Web.Compilation.CompilationUtil.GetTypeFromAssemblies(AssemblyCollection assembliesCollection, String typeName, Boolean ignoreCase) +176
       System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +325
       System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +38
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

    "Life is only a dream and we are the imagination of ourselves."
    by Bill Hicks
  • Re: Can't view project using Visual Studio 2008

    02-04-2008, 6:26 PM
    • Star
      9,042 point Star
    • HosamKamel
    • Member since 01-19-2006, 6:49 PM
    • Egypt
    • Posts 1,308

    Try to set the trust level

    <trust level="Full" originUrl="" />

    Hosam Kamel

    Remember to click on Mark as answer on the post that helped you
  • Re: Can't view project using Visual Studio 2008

    02-04-2008, 10:06 PM
    Answer

    It looks like P: is a network drive. Network locations are not considered trusted in .NET. Did the project work before? Generally you can adjust security policy using caspol.exe utility.

    Thanks

    ------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Can't view project using Visual Studio 2008

    02-05-2008, 2:59 AM
    • Member
      10 point Member
    • .NET
    • Member since 01-03-2008, 2:00 PM
    • Posts 57

    Hi Hosam,

    This didn't work I'm afraid.

    I tried what you suggested but the same error message appeared.

    The below is the part of my web.config which has been updated (maybe I added the trust level to wrong section - maybe it should sit within a <location><system.web> tag rather than within the main <system.web>...

    ....<connectionStrings/>

    <system.web>
          <
    trust level="Full" originUrl="" />

          <compilation debug="false">

          <assemblies>....



     

    "Life is only a dream and we are the imagination of ourselves."
    by Bill Hicks
  • Re: Can't view project using Visual Studio 2008

    02-05-2008, 3:04 AM
    • Member
      10 point Member
    • .NET
    • Member since 01-03-2008, 2:00 PM
    • Posts 57

    Hi Mikhail,

    Thanks for the reply, I'll see if I can download caspol.exe and change the trust settings.

    You are correct that this is a network drive, as the hundreds of projects I have wouldn't all fit on my PC's hard drive so I have to resort to storing my projects once completed on a network drive at my office and it's only now that I've had to go back to update a project that I thought I would just run VS and point to the relevant folder (saves me creating a new virtual directory in IIS and copying the folder/files over to my PC etc etc).

    "Life is only a dream and we are the imagination of ourselves."
    by Bill Hicks
  • Re: Can't view project using Visual Studio 2008

    02-05-2008, 3:28 AM
    • Contributor
      7,054 point Contributor
    • rjcox
    • Member since 12-19-2007, 9:14 AM
    • Basingstoke, UK
    • Posts 1,444

    .NET:
    I'll see if I can download caspol.exe
     

    CASPPOL.EXE comes with the .NET install. It is in %WinDir%\Microsoft.NET\Framework\v2.0.50727\

    For development purposes you should be using a command prompt with the frame folder included in its PATH. The VS Command Prompt shortcut on the start menu will be correctly set up.

    Richard
Page 1 of 1 (6 items)