Archive

Posts Tagged ‘Code Stuff’

.Net Again…VS2008 touching an old project

June 26, 2011 Leave a comment

Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Don’t you just love it?

How I got here:

Fired up VS 2008 and opened up the project from a network location.

SNAGHTMLbf0531

Ok, not a trusted location.  If you continue and try to run the project you will get a security issue.

Now this just seems wrong to me.  I’m on a VPN connection…

Yet I get…

[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) +42
   System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +145
   System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +73
   System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +111
   System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) 

 

OK OK

So, I copied the project to a local folder.  Tried VS again…

No change to the file but no warning message either…

No problem either.  The app fired up in VS just fine.

Now why didn’t it work?

One thing is Windows 7.  Windows 7 has trust issues!  Well, not really but the security is certainly increased.  Security state is persisted down so if you open a non-trusted location the files remain so.

Second thing… the credentials I used to access the network location through the VPN are different then the credentials I used to log on to the PC.  Again, there are certainly ways you can get around it but that’s another story.

So, will the copy fit the needs?

Well, hmmm.  …

A remote application NOT under source control can be copied down to a location where source control is used. 

The copy remains untouched until the changes are complete and tested.

A new copy can be put back up in the network location as the next rev.

Thanks to local source control, the changes are persisted.

We’re done here…

Ok, this is a quick and dirty way around a security challenge.  While perhaps not the most elegant solution it fit the bill.  Call it guerilla coding or what not, when you’re in the trenches, a simple copy paste keeps the hourly rate down.

Advertisements