Thursday, March 22, 2012

VisualWebPart error +--- is not allowed here because it does not extend class 'System.Web.UI.UserControl'."}

{"'TestWebPart.Test.TestUserControl' is not allowed here because it does not extend class 'System.Web.UI.UserControl'."}

I got this error when I copy pasted some code from another file and pasted on to an existing web part file.

The reason was that the namespaces were out of sync. Once I fixed that it worked fine ;)

Silly mistake but could take some time to realise
Cheers!

Wednesday, March 7, 2012

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map

.Net Error
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map

I got this error when I was trying to open a .aspx page on my Windows 7 machine. I realized I had installed IIS after .Net Framework. Hence, I had to re register my .NET framework on to IIS.

This is what I did to get rid of the error-
  • I have a 32 bit server so I navigated to the folder where my .Net framework files reside which in my case is -
             C:\Windows\Microsoft.NET\Framework\v4.0.30319

            and copied the path.
  • I opened the command prompt (run cmd from the Start menu)
  • did a cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
         to change directory
  • Ran the command aspnet_regiis -i
which Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below.

Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected.
Refer http://msdn.microsoft.com/en-us/library/k6h9cz8h%28VS.80%29.aspx for details
  • And then browsed my page again and voila it worked!
The logic is to use the ASP.NET IIS Registration Tool to register the .NET framework again

If aspnet_regiis -i doesn't do the job also try aspnet_regiis -ir

Merci!!