Weird ASP.NET Errors

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

Scott Michell wrote an excellent article about the above error explaining exactly why are you getting this error. Basically you are opening the parent folder of a project in Visual Studio and you get this error. Since web.config in this case is in sub folder, you get this error.

A little Explanation

There can be more than one web.conf files in your application. They can be all in root or in sub folders as in nested form. The root web.conf can contain almost all elements but that that are nested in sub folders may not contain certain elements. This error is about this scenario.

Resolution

Lets say you have project in this folder

d:\project\myfirstapp\main\

If you open myfirstapp in Visual Studio you will get the above error. To resolve reopen the project and select main as your project.

Weird ASP Bug – Gridview update does not work if there is somethign in page_load function

In my Gridview, select, insert, delete all were working properly but not Update. Found out that my code in Page_load() was causing this not to work. I removed the code from page load where I as updating the Gridview. The update started working again.

What is weird is there was no error and no indication where the problem was. You have to hunt all possible avenues to hunt for the error.

Weird ASP.NET Error – Insert does not work in FormView in ASP.NET

You have a FormView and an Insert Template inside it, if you put the insert template fields in an ASP.NET table for better formatting, the insert function will not work. This is very weird. In the above example, the fields in table … will not work. The culprit here is runat=”server”. If you remove this, the insert works.



... rows and cells

This is quite a weird error in ASP.NET. But the following works