Posts filed under 'ASP.Net'
Whilst porting an ASP.Net application to the .Net 2.0 framework, I came across a spurious error when viewing a few specific pages. The error was occurring during the runtime compilation of these specific aspx pages.
To make this error more confusing, the error was reported on line 1 of the aspx page which contained nothing more than the page directive tag.
After a bit of searching, I found the cause of the problem. The cause was that there were two member variables declared with names that differed only by case (one was an ASP.Net PlaceHolder control, the other an int). Simply renaming one of the variables solved the compilation error.
Eran Sandler has also encountered this problem, but delves a lot deeper into what is going on.
March 5th, 2007
Microsoft recently released Guidance Explorer, a tool that contains a browsable collection of best-practice patterns for developing .Net and ASP.Net applications.
Both the tool and its guidance library have regular updates, containing best-practices for performance and security related issues.
The tool also has the ability to add custom sets of guidance to allow corporate/team standards to be included.
July 19th, 2006
Nikhil Kothari has made a nice little Web Development Helper for ASP.Net. It works as a plugin for Internet Explorer and is similar to the Internet Explorer Development Toolbar, but with more of an ASP.Net twist.
Some of its most useful features are:
- Rich error information for script errors, including call stack, script url and line number.
- A DOM inspector with filtering to enable easy viewing of particular items.
- A view state browser.
- Trace information can be shown in a separate dialog instead of in the page itself.
- A full HTTP/HTTPS logger showing all traffic between the browser and the server.
The Web Development Helper requires .Net 2.0 to run and can only work on the same machine as the server, but this should not be a problem during development.
After installation, I had the same problem that lots of other people seem to have in that clicking the newly installed toolbar button did nothing. The suggested fix of installing the Internet Explorer Development Toolbar solved the problem though. Nikhil also suggested that a reboot (or killing explorer.exe) may also work because information about plugins is cached on startup.
July 10th, 2006
Chris Sells posted a useful tip (courtesy of Scott Guthrie) about duplicate types when compiling using the web application project model in VS2005.
The error displays as:
The solution is simply (although not obviously) to add the batch="false" attribute to the compilation element in the web.config file:
This generates a lot fewer assemblies and avoids the problem.
Update: According to Mike Harder (a Software Design Engineer on the ASP.NET team) in his recent post on the ASP.Net forums, this is a known bug in the ASP.Net compiler involving directory level circular references. An alternative fix to the batch="false" option is to reorganise the files in the web application to avoid a circular reference.
June 9th, 2006