On my Login page only I am getting 18 JavaScript errors and the main one seems to be: 'ASP.NET Ajax client-side framework failed to load.' I have a feeling it has to do with security since I just recently added Forms Authentication to the site. If I login all errors go away.
It seems like sys is undefined when this line tries to run :
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
I have the following in my Web.config:
<authentication mode="Forms">
<forms name=".FormsAuthCookie" loginUrl="Security/Login" protection="All" timeout="120" cookieless="AutoDetect" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
THE MAIN PROBLEM after adding deny users="?":
ASP.NET Ajax client-side framework is failing to load on my Login.aspx page when an anonymous user visits the site.
UPDATE:::
This really doesn't make much sense but after adding EnableCdn="true" to my script manager I do not get any errors when an anonymous user visits the login page.... It just seems like it is a hack for whatever my actual problem is since this is a clean .net webforms project.
<asp:ScriptManager runat="server" EnableCdn="True">
Sounds like the authentication is blocking access to the javascript library. if you view the network tab in chrome do you get any errors loading the js files? if so I would say add an exception to the directory in your config file.
Something like:
<location path="js">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
I think the reason CDN works is because the files are being loaded from a CDN as oppose to your app so there is no authentication needed for the CDN server.
Based on the accepted answer above here is the web.config
configuration needed if you are working with the Visual Studio 2015 ASP.NET 4.5 WebForms Application project template:
<location path="bundles">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
The bundles
folder does not physically exist but is the virtual path for the bundled scripts. See App_Start\BundleConfig.cs
for more information.
Please note that allowing access to ScriptResource.axd
and/or WebResource.axd
in web.config
as suggested over and over again in so many other threads just will not work with the bundling setup of the Visual Studio 2015 ASP.NET 4.5 WebForms Application project template.