Archive for the ‘ASP.Net’ Category

Supressing CSS Errors in Visual Studio 2010

Thursday, November 18th, 2010

While attempting to migrate some older, legacy ASP.Net pages from VS 2005 to VS 2010 I started getting the following errors:

Validation (CSS 2.1): 'set-focus' is not a known CSS property name.

These were fatal errors and were preventing me from making any further progress. Given that, at this point, I don’t really care if the HTML validates without errors I went looking for a way to prevent Visual Studio from producing these errors.  I finally found it in Tools | Options | Text Editor | CSS | Miscellaneous.  Simply uncheck the Detect Errors box.

Mixed Language Programming in ASP.Net

Thursday, November 18th, 2010

For historical reasons I find myself developing some ASP.Net content in a mixed language environment.  I have some older, legacy code written in C# that I need to integrate into a new web site written using VB.Net.  Putting the VB.Net .ASPX pages into a separate directory from the C# .ASPX pages got around most of the problem, but I was left with some common code that belongs in the App_Code directory of both sites.  .Net won’t let you compile mixed languages into a single assembly, and since everything the the App_Code directory needs to be compiled into a single assembly I was in a bit of a quandary about what to do.

Fortunately, it turns out there is a simple solution to the problem.  You just need to put your C# code into a sub-directory of the App_Code directory and make an entry in the  <compilation> section of the web.config file. Add the following XML:

<compilation ... >
<add directoryName="App_Code_CS" />

Where App_Code_CS is the name of the sub-directory containing the C# code.

Developing ASP.Net Applications on a Network Share

Tuesday, November 9th, 2010

If you keep all of your development projects on a network share like I do then you have probably had to deal with certain challenges regarding permissions along the way.  In the Win32 world this isn’t usually too bad, but in the .Net world it can become a major pain in the butt.  This is especially true of ASP.Net applications.

I recently started work on my first ASP.Net application.  Everything was going fine until I tried to execute it.  Visual Studio’s internal web server basically told me to piss off.   It turns out that, by default, ASP.Net will not execute applications from a network share.

Once you know the secret, fixing this is actually not that difficult.  You have to add a line to the devenv.exe.config file for your version of Visual Studio.  For Visual Studio 2010 this is found in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE.    In the <runtime> section of the configuration file you need to add:

<loadFromRemoteSources enabled=”true” />

That’s all there is to it.