What am I missing in IIS7? - asp.net

Ok here is my dilemma, I have been developing on a shared host at discountasp.net (IIS 6)for some time now. All was going well, however now that app is complete we are moving it to its own dedicated server which is now server 2008 and IIS 7.
I am currently using asp forms authentication (which again seems to work just fine on IIS6)
The issue seems to occur after I click login, it pops the "Signing In" box..an error then arises in the JavaScript of Membership.js "Object Does not Support Membership.js" I verified that the code was making it to: membership.BeginLogin(uid, pwd, rememberme); and was in fact passing the correct variables.
Another odd thing I noticed when setting the forms permissions is that when I went to select Users or Roles within the IIS 7 management console it would take forever, and then time out with the following error:
A Network related or instance specific error occurred while establishing a connection to SQL Server. The server was not or was not accessible, verify that the instance name is correct and that SQL Server is configured to allow remote connections (provider - named pipes provider: error 40 - could not open a connection to SQL Server.)
I am rather weak on the hardware/configure side of the house so I am not really sure what the issue is, it’s almost as if IIS7 cannot see the DB. They both reside on the same server however. If anyone could help point me in the right direction as to how to resolve this I would be eternally grateful!
Thanks in advance
Bryan

I'm not a web server expert either. However, I have faced the same problems when moving from IIS6 to 7.
I have put the following configuration in my Web.config to get rid of the problem:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
Seems that it is required prior to run ASP.NET Ajax on IIS7.

Related

POST 403 Forbidden for ScriptResource.axd

We're running into a strange issue with the development version of one of our websites. When triggering a postback on the page through a DropDownList OnChange event, the following error is displayed in the browser console:
POST <URL here> 403 (Forbidden)
Uncaught #<Error>
Viewing the generated IIS error page is not helpful. It indicates the following:
Module ManagedPipelineHandler
Notification ExecuteRequestHandler
Handler PageHandlerFactory-Integrated-4.0
Error Code 0x00000000
This is for a ScriptResource.axd. Now here's the strange part: this issue didn't start happening until our other developer started publishing the site. Previously, I was publishing it with no issues. There have been no web.config changes (in fact, it's identical to our production web.config, which works perfectly). I've scoured the web for clues regarding why we would be getting this issue, and it seems to be mostly related to either the <handlers> section in <system.webServer>, or the <httpHandlers> in <system.web>. The relevant sections are listed below:
<httpHandlers>
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
</httpHandlers>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
From what I've seen, this appears to match what other users say works well for them. One interesting thing of note is that the 403 Forbidden appears to be on POST. I did try adding POST as a verb in both of those locations for ScriptResource.axd, but this did not work either.
The website is hosted in IIS 7.5 under an Application Pool using Network Service. Network Service does have full control under the root folder for the website.
At this point, I'm at a complete loss as to what could be causing our bizarre issue.
My Hosting use Plesk and I also met this issue after they upgrade the server.
After changing Web Application Firewall Mode to Off/Detection only, this issue is fixed.
I had the same issue on the plesk hosting server, after tracing the request and check why it return 403 access is denied error i found that the hosting server has web application firewall (WAF) installed and this firewall block these request so you need to add rule to allow these request or turn it off.
For hosting companies using Plesk control panel, you can turn off the Web Application Firewall(WAF), but the purpose of WAF is to help protect your website from various attacks. Instead, turn off only the specific Rule IDs that are causing the issue. In this case, you want to allow .axd files on your website.
Identify this specific Rule ID that is being violated by opening the "ModSecurity Logfile" on the Plesk WAF page.
Search for the 403 Access Denied message in the logfile and then look for a substring that looks like [id "942440"]. This is the rule ID that is being violated.
Switch off the "Security Rule" that applies to this issue, by typing the ID number in the "Switch off Security Rules" section on the Plesk WAF page. In this example, you would type just the numbers "920440" inside the text box.

AjaxToolkit Asp.net 3.5 Sys Not Defined

I am trying to use the AjaxToolkit for a Asp.net 3.5 project. I have an existing project that I added the ajax configuration using this link http://www.asp.net/ajax/documentation/live/ConfiguringASPNETAJAX.aspx but I am getting a javascript error of Sys not defined. I am wondering if it has something to do with the handlers that were set up. I am using IIS 6 on a windows 2003 server using a .net 3.5 project any one have any ideas?
HTTP Handlers:
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
My full web.config
http://pastebin.com/8AFLA3KA
You are missing the web.config entry in system.webserver.
Without the system.webserver entry, it will work on the development server and iis 6-, but not on IIS 7+ in integrated mode.
Another option is to switch the IIS7 app-pool into classic mode.
The Visual Studio web application templates got updates with a service pack, but your project got created before that update :)
Just make sure you installed all updates, create a new ajax project, and compare the web.config file.

asp.net application iis7 sessionstate is crossing over multiple users in different locations

got a asp.net web app (2.0) which we moved over from iis 6 to iis 7.
it worked good for 6 months. three days ago we have been seeing issues that one loged in users sees other user information. ( session info )
session is in proc
the only thing i see different is iis7 app pool is in integrated mode.
we have taken the app down.
app web config is as below
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode"/>
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
does any one have a clue what it could be
the application did not have this issue in iis6 for a year n didnt have any issues in iis7 for 6 months.
we are not using any global variables...
iis7 has a feature / bug
output cashing over application pool
for 3.5 (classic) mode need to explicitly turn it off on .aspx extentions
IIS7 Sessions Getting Crossed / Mixed Up / Copied
I have detected a problem on a web farm:
IIS 7 Sessions of the useres were getting Crossed / Mixed Up / Copied. A user was getting the session of another!!!!
After some research I found that IIS 7 now has the ability to cache dynamic content as well.
It is a new feature in IIS7, this version of IIS introduced some new caching features.
(i) IIS7 automatically caches static content, such as HTML pages, images, and style sheets.
(ii) IIS7 now has the ability to cache dynamic content as well.
In IIS7, disable the caching for .aspx pages in any directory with an asp.net page that depends on the session state. The steps to do this are:
1. Run the Server Management console and navigate to Roles -> Web Server (IIS) -> Internet Information Services.
2. Select the site you wish to modify.
3. Select the folder that contains the .aspx pages you need to turn caching off for.
4. In the Feature View, double-click “Output Caching”.
5. If there is a rule there already for the .aspx extension double click it. Otherwise right click and select “Add…”
6. Enter .aspx for the “File name extension”
7. Check "User-mode caching", "Prevent all caching", check "Kernel-mode caching" and "Prevent all caching"

UrlRewritting + ASP.NET AJAX + IIS 7 on localhost + IIS 7 Remote

I am getting these issue in my website if i use UrlRewritting with ASP.NET AJAX
I was getting ScriptResource.axd 404 Error on Devserver I removed that by using Rewrite rule for that and add that following code in web.config's section
<httpHandlers>
<add verb="GET,HEAD"
path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
that method fixed my problem... but
I configured on my local PC's IIS 7 It is creating same problem so found the solution for IIS 7. I removed above and and add new code in web.config's section
<handlers>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
that code fixed my problem...... but
when I configure on remote IIS i am getting same problem........ any one can answer How can I solve that???
I got the solution actually problem is version of System.Web.Extensions I changed version Version=1.0.61025.0 to Version=3.5.0.0 and it is work now.....

Sys is undefined

I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error "Sys is undefined".
It doesn't happen all the time, but it is reproducible. When it happens, the user has to shut down their browser and reopen the page.
This leads me to believe that it could be an IIS setting.
Another note. I looked at the page source both when I get the error, and when not. When the page throws errors the following code is missing:
<script src="/ScriptResource.axd?d=EAvfjPfYejDh0Z2Zq5zTR_TXqL0DgVcj_h1wz8cst6uXazNiprV1LnAGq3uL8N2vRbpXu46VsAMFGSgpfovx9_cO8tpy2so6Qm_0HXVGg_Y1&t=baeb8cc" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
</script>
I fixed my problem by moving the <script type="text/javascript"></script> block containing the Sys.* calls lower down (to the last item before the close of the body's <asp:Content/> section) in the HTML on the page. I originally had my the script block in the HEAD <asp:Content/> section of my page. I was working inside a page that had a MasterPageFile. Hope this helps someone out.
When I experienced the errors
Sys is undefined
ASP.NET Ajax client-side framework failed to load
in IE when using ASP.NET Ajax controls in .NET 2.0, I needed to add the following to the web.config file within the <system.web> tags:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler" validate="false"/>
</httpHandlers>
Try setting your ScriptManager to this.
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
Dean L's answer, https://stackoverflow.com/a/1718513/292060 worked for me, since my call to Sys was also too early. Since I'm using jQuery, instead of moving it down, I put the script inside a document.ready call:
$(document).ready(function () {
Sys. calls here
});
This seems to be late enough that Sys is available.
I was using telerik and had exactly same problem.
adding this to web.config resolved my issue :)
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
maybe it will help you too. it was Authentication problem.
Source
Try one of this solutions:
1. The browser fails to load the compressed script
This is usually the case if you get the error on IE6, but not on other browsers.
The Script Resource Handler – ScriptResource.axd compresses the scripts before returning them to the browser. In pre-RTM releases, the handler did it all the time for all browsers, and it wasn’t configurable. There is an issue in one of the components of IE6 that prevents it from loading compressed scripts correctly. See KB article here. In RTM builds, we’ve made two fixes for this. One, we don’t compress if IE6 is the browser client. Two, we’ve now made compression configurable. Here’s how you can toggle the web.config.
How do you fix it? First, make sure you are using the AJAX Extensions 1.0 RTM release. That alone should be enough. You can also try turning off compression by editing your web.config to have the following:
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="true" />
</scripting>
</system.web.extensions>
2. The required configuration for ScriptResourceHandler doesn’t exist for the web.config for your application
Make sure your web.config contains the entries from the default web.config file provided with the extensions install. (default location: C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025)
3. The virtual directory you are using for your web, isn’t correctly marked as an application (thus the configuration isn’t getting loaded) - This would happen for IIS webs.
Make sure that you are using a Web Application, and not just a Virtual Directory
4. ScriptResource.axd requests return 404
This usually points to a mis-configuration of ASP.NET as a whole. On a default installation of ASP.NET, any web request to a resource ending in .axd is passed from IIS to ASP.NET via an isapi mapping. Additionally the mapping is configured to not check if the file exists. If that mapping does not exist, or the check if file exists isn't disabled, then IIS will attempt to find the physical file ScriptResource.axd, won't find it, and return 404.
You can check to see if this is the problem by coipy/pasting the full url to ScriptResource.axd from here, and seeing what it returns
<script src="/MyWebApp/ScriptResource.axd?[snip - long query string]" type="text/javascript"></script>
How do you fix this? If ASP.NET isn't properly installed at all, you can run the "aspnet_regiis.exe" command line tool to fix it up. It's located in C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727. You can run "aspnet_regiis -i -enable", which does the full registration of ASP.NET with IIS and makes sure the ISAPI is enabled in IIS6. You can also run "aspnet_regiis -s w3svc/1/root/MyWebApp" to only fix up the registration for your web application.
5. Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7
Put this entry under <system.webServer/><handlers/>:
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
and remove the one under <system.web/><httpHandlers/>.
References:
http://weblogs.asp.net/chrisri/demystifying-sys-is-undefined
http://geekswithblogs.net/lorint/archive/2007/03/28/110161.aspx
I hate adding to such a huge topic and so much later, but I've think I have a solution that works in VS2015 at the very least.
I was on a hunt to find a reason for the sys error, and the only solution that worked for me was to add EnableCdn="true" in a ScriptManager like this:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true" />
See the MSDN for more information.
Why do we need to do this?
When working on a asp.net web application, you have to enable CDN so that Microsoft can download the Sys. library.
There was probably a script in your page that was using the Sys function. Setting EnableCdn="true" would ensure that the Sys library is downloaded before it is used.
What's CDN?
It stands for "Content Delivery Network" and enabling it allows certain resources to download with simple references.
A quote from https://www.sitepoint.com/7-reasons-to-use-a-cdn/
Most CDNs are used to host static resources such as images, videos,
audio clips, CSS files and JavaScript. You’ll find common JavaScript
libraries, HTML5 shims, CSS resets, fonts and other assets available
on a variety of public and private CDN systems.
Both Google and Microsoft have CDNs. All you have to do is add a reference. Usually CDNs are added via a script resource:
<script src="https://ajax.aspnetcdn.com/ajax/4.5.1/1/MicrosoftAjax.js" type="text/javascript"></script>
Once you set EnableCdn="true" and Microsoft will add it's little CDN reference (like the one above) in the page which downloads the Sys library.
I hope that helps anybody that ran into the same issue.
You must add these lines in the web.config
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
Hope this helps.
In addition to ensuring you have the ScriptManager on your page you need to ensure that your web.config is appropriately configured.
When ASP.NET AJAX 1.0 was released (for .NET 2.0) there was a lot of custom web.config settings which added handlers, controls, etc.
You'll find the config info here: http://www.asp.net/AJAX/documentation/live/ConfiguringASPNETAJAX.aspx
Make sure that any client scripts you have that interact with .NET AJAX have the following line at the end:
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
This tells the script manager that the whole script file has loaded and that it can begin to call client methods
I was having this same issue and after much wrangling I decided to try and isolate the problem and simply load the script manager in an empty page which still resulted in this same error. Having isolated the problem I discovered through a comparison of my site's web.config with a brand new (working) test site that changing <compilation debug="true"> to <compilation debug="false"> in the system.web section of my web.config fixes the problem.
I also had to remove the <xhtmlConformance mode="Legacy"/> entry from system.web to make the update panel work properly. Click here for a description of this issue.
I solved this problem by creating separate asp.net ajax solution and copy and paste all ajax configuration from web.config to working project.
here are the must configuration you should set in web.config
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</configSections>
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
In case none of the above works for you, and you happen to be overriding OnPreRenderComplete, make sure you call base.OnPreRenderComplete. My therapist is going to be happy to see me back
I had the same problem after updating my AjaxControlToolkit.dll to the latest version 4.1.7.725 from 4.1.60623.0.
I've searched and came up to this page, but none of the answers help me.
After looking to the sample website of the Ajax Control Toolkit that is in the CodePlex zip file, I have realized that the <asp:ScriptManager> replaced by the new <ajaxtoolkit:ToolkitScriptManager>. I did so and there is no Sys.Extended is undefined any more.
In my case the problem was that I had putted the following code to keep the gridview tableheader after partial postback:
protected override void OnPreRenderComplete(EventArgs e)
{
if (grv.Rows.Count > 0)
{
grv.HeaderRow.TableSection = TableRowSection.TableHeader;
}
}
Removing this code stopped the issue.
Was having a similar issue, except that my page was consistently generating the Sys is undefined error.
For me the problem stems from the fact that I've just installed the AJAX 1.0 extension for .NET 2.0 but had already created my web project in Visual Studio.
When tried to create AJAX controls I kept encountering this error, I spotted Slace's and MadMax1138s posts here. And figured it was my web.config, I created a new project using the new "AJAX enabled web site" project type, and sure enough the web.config has a large number of customizations necessary to use the AJAX controls.
I just updated that web.config with the web.config updates I had already made myself and dropped it into my existing project and everything worked fine.
I have been seeing the exact same error today, but it was not a config or direct JavaScript issue.
An external .net project had been updated but the changes not picked up properly in the compilation of the web site. My presumption is that ASP.NET ajax was not able to construct the client representations of the .NET objects properly and so was failing to load correctly.
To resolve, I rebuilt the external project(s), and rebuilt my solution that was experiencing issues. The problem went away.
I found the error when using a combination of the Ajax Control Toolkit ToolkitScriptManager and URL Write 2.0.
In my <rewrite> <outboundRules> I had a precondition:
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html"/>
</preCondition>
</preConditions>
But apparently some of my outbound rules weren't set to use the precondition.
Once I had that preCondition set on all my outbound rules:
<rule preCondition="IsHTML" name="MyOutboundRule">
No more problem.
Make sure you don't have any Rewrite rules that change your url.
In my case the application thought it was only level deeper then the url reached.
Example: http://mysite.com/app/page.aspx was the real url.
But i cut off /app/ this worked fine for ASP.net and WCF, but clearly not for Ajax.
I had similar problems and to my surprise what I found that one of my developer had saved web.config in the same folder/solution as web123.config and by mistake both of these files were uploaded.
As soon as I deleted the web123.config file, this error disappeared and ajax framework was loading correctly. even though I have
<compilation debug="true">
In my case I also have following segment. My project is using framework 3.5
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
This is going to sound stupid but I had a similar problem with a site being developed in VS2010 and hosted in the VS Dev Server. The page in question had a scriptmanager to create the connection to a wcf service. I added an extra method to the service and this error started appearing.
What fixed it for me was changing from 'Auto-assign Port' to 'Specific port' with a different port number in the oroject Web settings.
I wish I knew why...
Development Environment:
Dev-Env: VS 2012
FX: 4.0/4.5
Implementations: Master(ScriptManager + UpdatePanel/Timer) + Content (UpdatePanel)
Patterns: PageRouting.
Disclaimer:
If all the web.config solutions do not work for you and you have implemented PageRouting (IIS 7+), then the code snippet below will solve your problems.
Background:
Dont mean to Highjack this question but had the same problem as everyone else and implemented 100% of the suggestions here, with minor modifications for .Net 4.0/4.5, and none of them worked for me.
In my situation i had implemented Page Routing which was ghosting my problem. Basically it would work for about 20, or so, debug runs and then BAM would error out with the Sys is undefined error.
After reviewing a couple other posts, that got to talking about the Clean-URL logic, i remembered that i had done PageRouting setup's.
Here is the resource i used to build my patterns: Page Routing
My one-liner code fixed my VS2012 Debugging problem:
rts.Ignore("{resource}.axd/{*pathInfo}") 'Ignores any Resource cache references, used heavily in AJAX interactions.
Even after adding the correct entry for web config still getting this error ? most common reason for this error is JavaScript that references the Sys namespace too early.
Then most obvious fix would be move the java script block below the ScriptManager control:
I don't think this point has been added and since I just spent some time hunting this down I hope it can help.
I am working with IIS 7 and using the ASP.NET v4 Framework.
In my case it was important that an entry be added to both the and section of the entry in the web.config file.
My web.config file has a lot of handlers and in my case it was easiest to add the ScriptResources entry to the top of the handlers section. Most importantly, it needs to be placed before any entry that will act as a wildcard and capture the request. Adding it after a wildcard entry will cause it to be ignored and the error will still appear.The module can be added to the top or bottom of the section.
Web.config Sample:
<system.webServer>
<handlers>
<clear />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<!-- Make sure wildcard rules are below the ScriptResource tag -->
</handlers>
<modules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<!-- Other modules are added here -->
</modules>
</system.webServer>
I had same probleme but i fixed it by:
When putting a script file into a page, make sure it is
<script></script> and not <script />.
I have followed this:
http://forums.asp.net/t/1742435.aspx?An+element+with+id+form1+could+not+be+found+Script+error+on+page+load
Hope this will help
Add
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
Please check enter link description here
In my case, I've found a very hidden reason ... There was this page route with in Global.ascx.cs which doesn't appear in my tests in sub-folders but returns the question error all the time .. another day with strange issues.
routes.MapPageRoute("siteDefault", "{culture}/", "~/default.aspx", false, new RouteValueDictionary(new { culture = "(\\w{2})|(\\w{2}-\\w{2})" }));
I know this is an old thread but I found a somewhat unique solution. In my case I was getting the error because I am using both Webforms and MVC in the same ASP.NET web application. After mapping routes the issue showed up. I fixed it by adding the following code to ignore routes for both "{resource}.aspx/{*pathInfo}" and "{resource}.axd/{*pathInfo}"
private void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Test", action = "Index", id = UrlParameter.Optional }
);
}
Please please please do check that the Server has the correct time and date set...
After about wasting 6 hours, i read it somewhere...
The date and time for the server must be updated to work correctly...
otherwise you will get 'Sys' is undefined error.
Hi thanx a lot it solved my issue ,
By default vs 2008 will add
<!--<add verb="*" path="*.asmx" validate="false" type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false" />-->
Need to correct Default config(Above) to below code
FIX
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler" validate="false"/>

Resources