Monday, August 15, 2011

Unknown server tag 'asp:ScriptManager'

LiveJournal Tags:
This exception has popped up more than once for me, but the answer when searching for help is always the same.  Add the following to your web.config (or similar based on your version of .Net).
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
This simple solution of course is never the case for me.  If you have the above already in your web.config, the gist of the real problem is that your web.config is actually not loading into the current context due to some other error.
I thought I’d offer some steps I’ve used that seem to always fix the problem for me. 
LiveJournal Tags:
  1. If you are using Local IIS Server as your hosting server, switch to the built-in Visual Studio Development Server temporarily and see if the website loads normally.
    • If your website loads normally in the built-in web server;  sometimes Visual Studio botches the creation of the IIS virtual directory and application.  Check IIS admin to see if your settings are correct (or if the virtual directory even exists!).
  2. Try commenting out the entire script tag (<asp:ScriptManager ID="ScriptManager1" runat="server" />) and see if it reveals the real error.  Any other custom controls on the page may fail as well, so keep commenting out until you either see a different error or the page loads normally.
  3. Add the namespace mapping directly to the page.  This is a last resort, but sometimes necessary to just get by the problem.
    • <@ Register Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" TagPrefix="asp" %>



6 comments:

ahmed ali

when i put this

in my web.config another error occured this new error is as follow

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:


[No relevant source lines]


Source File: none Line: 0

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.


Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\winnt\system32\inetsrv\w3wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = System.Web.Extensions, Version=2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Partial)
LOG: Appbase = file:///D:/Raya/Web Apps/ARMS/
LOG: Initial PrivatePath = D:\Raya\Web Apps\ARMS\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Raya\Web Apps\ARMS\web.config
LOG: Using host configuration file: \\?\C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINNT\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

Billy

Did you put <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> in your web.config instead of what I had?

It sounds like you are using a 2.0 project

shanecastane

The Microsoft Small business server package has been available since the NT4 based version SBS4.0 it has Small Business Server well for years and now there are new versions. This is review of the package will focus on the SBS2000 and SBS2003 packages with a brief look at the future versions.

liza karen

i need a web developer who have knowledge about PublicKeyToken ERROR 31bf3856ad364e35. And also need help for a website design subjct is Best wedding planner Perth Australia

Shane Castane

I need an IIS Server as my hosting server. Is there any suggestion for me? Contact here plz

ellyhower

You given information aren't helpful to determine why the assembly 'System.Web.Extensions, Version=2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded. Have you any other solution? Please visit my blog.