My web.config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="500" redirect="~/Content/ErrorPages/500.aspx" />
<error statusCode="404" redirect="~/Content/ErrorPages/404.aspx" />
</customErrors>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>
</system.web>
<rewriter configSource="Config\URLRewrites.config" />
<appSettings configSource="Config\Settings.config" />
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<httpErrors errorMode="Custom">
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/Content/ErrorPages/404.aspx" responseMode="ExecuteURL" />
<error statusCode="500" path="/Content/ErrorPages/500.aspx" responseMode="ExecuteURL" />
</httpErrors>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRewriter" />
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="managedHandler" />
</modules>
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
My global.asax:
using System;
using System.Web;
using StackExchange.Profiling;
namespace C3
{
public class Global : HttpApplication
{
protected void Application_BeginRequest(object sender, EventArgs e)
{
// Force to HTTPS
if (!HttpContext.Current.Request.IsSecureConnection)
{
Response.Redirect(Settings.SecureRootDomain + HttpContext.Current.Request.RawUrl);
}
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
}
}
Content page:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="C3.Default"%>
<%# Import Namespace="C3.Code" %>
<%# Import Namespace="StackExchange.Profiling" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<%
SEO.CheckURL("/");
%>
<title></title>
<%=MiniProfiler.RenderIncludes() %>
</head>
<body>
<form id="form1" runat="server">
<div>
dum de dum
</div>
</form>
</body>
</html>
And code behind:
protected void Page_Load(object sender, EventArgs e)
{
var profiler = MiniProfiler.Current; // it's ok if this is null
using (profiler.Step("Set page title"))
{
Page.Title = "Home Page";
}
using (profiler.Step("Doing complex stuff"))
{
using (profiler.Step("Step A"))
{ // something more interesting here
Thread.Sleep(100);
}
using (profiler.Step("Step B"))
{ // and here
Thread.Sleep(250);
}
}
}
Any ideas why the MiniProfiler isn't showing anything?
Update
If I visit https://127.0.0.1:3333/mini-profiler-resources/includes.js in my browser, it's returning the JS file! It's just not rendering the includes on the page itself.
If I visit /mini-profiler-resources/results it throws the error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
StackExchange.Profiling.MiniProfilerHandler.GetSingleProfilerResult(HttpContext
context) in
c:\TeamCity\buildAgent\work\1de24adb938b932d\StackExchange.Profiling\MiniProfilerHandler.cs:292
StackExchange.Profiling.MiniProfilerHandler.ProcessRequest(HttpContext
context) in
c:\TeamCity\buildAgent\work\1de24adb938b932d\StackExchange.Profiling\MiniProfilerHandler.cs:93
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+912 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +164
Ensure pages showing the MiniProfiler don't contain an ignored path in the URL specified by MiniProfiler.Settings.IgnoredPaths, which by default has /content/, /scripts/ and /favicon.ico. A page with the URL /content/Default.aspx won't show the MiniProfiler, whereas /Pages/Default.aspx will show it.
Alternatively, remove /content/ from MiniProfiler.Settings.IgnoredPaths.
I've put together a very basic tutorial for a jQuery Mobile app with a very basic tutorial using the Web Api with VS 2013 and VB.NET. The Web Api is just for use with my UI within my app as a way to bridge between html and asp.net. It works perfectly on my development machine but the Web Api part fails when I move it to my hosting service (WinHost). I assume that there is a web.config entry that will fix this - but, I'm totally lost on this point. The html/jQuery code is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/custom.css" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.3.2/jquery.mobile.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<title>Boilerplate</title>
<script>
var uri = 'api/class1s';
function formatItem(item) {
return item.field1;
}
function find() {
var id = $('#prodId').val();
$.getJSON(uri + '/' + id)
.done(function (data) {
$('#product').text(formatItem(data));
})
.fail(function (jqXHR, textStatus, err) {
$('#product').text('Error: ' + err);
});
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Boilerplate</h1>
</div>
<div data-role="content">
<p>Page Body content</p>
<div>
<input type="text" id="prodId" size="5" />
<input type="button" value="Search" onclick="find();" />
<p id="product" />
</div>
</div>
<div data-role="footer">
<h4>Footer content</h4>
</div>
View Full Site
</div>
</body>
</html>
The web.config is:
<configuration>
<appSettings></appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>
There is also a WebApiConfig:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web.Http
Public Module WebApiConfig
Public Sub Register(ByVal config As HttpConfiguration)
' Web API configuration and services
' Web API routes
config.MapHttpAttributeRoutes()
config.Routes.MapHttpRoute(
name:="DefaultApi",
routeTemplate:="api/{controller}/{id}",
defaults:=New With {.id = RouteParameter.Optional}
)
End Sub
End Module
There is also a class to define the data and a controller to populate data and return data via the Web Api.
These should not affect this problem (and work perfectly on my desktop PC).
Otherwise, this is just a standard VS2013 ASP.Net 4.5.1 project using an empty website with the Web Api option selected.
Is there a way to get this program to work on the hosting service?
I have an error Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load. on a blank page using masterpage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="True">
</asp:ScriptManager>
</form>
</body>
</html>
This is what it render it the end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form method="post" action="WebForm2.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjE2OTgwNTY5ZGTfWA/dEX85PXBlbkKsVxeLKyIn+mJQ9piW5cbeNE+qww==" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="http://ajax.microsoft.com/ajax/4.0/2/WebForms.js" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=6x_aX-LOcgUU-O_K6nM7ST5ViC_naT1e4_j-CY35ASRLpcKYpiapwTARuePHvx3llP-Xhl_AG_ubpM1BzkM5iyn9ThB3m7lmXKvkck0cxTcYiT-VbeKgamKxp9EwxBUyIQN6sSCU9SQm3tMtmzQWRg2&t=ffffffffbad362a4" 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>
<script src="/ScriptResource.axd?d=khKEuZ4oUqBYvQxJ1ISpPVIW8_AWWc907q5_v74DI2ruWKTJpldq2osxPkAZ__hffe1Q6HTQUyTbL3Q1mD6MX7V65O5ibxKwb4NvN6ycdZ8vEJ-bz51MO-8uoaP2xioK6npm5n8vldI1d0sOCnH6yw2&t=ffffffffbad362a4" type="text/javascript"></script>
<div>
</div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', 'form1', [], [], [], 90, '');
//]]>
</script>
</form>
</body>
</html>
The problems might be that i used to have AjaxControlToolkit in my project but later i use jquery instead. so somewhere in the project might try to add Ajaxcontroltoolkit which i can't find it. i don't know how to fix this error. i have tried to add bin file of ajaxcontroltoolkit back but it seems to not work.
this solution works for me:
The error on client was:
SCRIPT5022: ASP.NET Ajax client-side framework failed to load.
SCRIPT5009: 'Sys' is undefined
After many time to mining the websites, and more solutions, i solve the problem:
the solution for .NET 4.0 is:
Set EnableCdn property of script manager to true, Like this:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true">
Next Solution and Better Solution is:
add this handler to your web.config
<system.webServer>
<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=4.0.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=4.0.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=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
Sys undefined means that you're not getting the client side files loaded on your browser.
Solution 1:
<add verb="GET"
path="ScriptResource.axd"
type="Microsoft.Web.Handlers.ScriptResourceHandler"
validate="false"/>
Solution 2: If you don't have this, add this too under <assemblies>
<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Solution3: If that doesn't work too, try deleting files from your "bin" folder and rebuild the solution and clear the cache of your browser.
Solution 4: Add this to your web.config
<location path="ScriptResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
for telerik web resources use this code:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
I had enabled WebForms Routing and forgot to add the exception for resources:
routes.Ignore("{resource}.axd/{*pathInfo}");
Another possible cause is script combining/compression in IE 8 & 9. In web.config at the top level (within Configuration), put
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="true" />
</scripting>
</system.web.extensions>
On your ToolKitScriptManager put CombineScripts=False, e.g.
<asp:ToolkitScriptManager runat="server" CombineScripts="False">
</asp:ToolkitScriptManager>
see http://robmzd.blogspot.com/2010/02/invalid-character-error.html which is where I figured out the problem
Add EnableScriptCombine="False" to your RadScriptManager as follows:
<telerik:RadScriptManager ID="RadScriptManager1" EnableScriptCombine="False" runat="server" />
I had this problem when I moved my forms to a new server. I spent hours to find the solution.
The problem was that the new server has ASP.NET 4.0 and my web.config was ASP.NET 3.5. So I made a new web.config and everything is ok now.
Simply add the <handlers> section as shown below in your web.config within <system.webServer> and this will fix the problem in no time.
<system.webServer>
.
.
.
<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" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
For me it was the problem with Global.asax code,
Just check below condition before validating session in Application_PreRequestHandlerExecute
Request.Path.ToUpper() != Constants.AliasName.ToUpper() + "SCRIPTRESOURCE.AXD"
Functional code is shown below,
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
{
if ((Request.Path != Constants.DebugLoginUrl) &&
(Request.Path != Constants.SessionTimeOut) &&
(Request.Path.ToUpper() != Constants.AliasName.ToUpper() + "TRACE.AXD") &&
(Request.Path.ToUpper() != Constants.AliasName.ToUpper() + "SCRIPTRESOURCE.AXD"))
{
// to prevent check of HTTP HANDLER FLUSH - Session State is Invalid
if (HttpContext.Current.Session != null)
{
if (Session[Constants.personId] == null)
{
//your code
}
else
{
Response.Redirect(Constants.SessionTimeOut);
}
}
}
In my case the Ajax loading error occurred only if I reloaded the page, not when the page was loaded for the first time.
Looking at the content in the tag in Site.Master, I noticed that only some of the items had Path attribute set. So, I updated MsAjaxBundle to this: and the problem went away. I also had to modify the WebFormsBundle the same way and now reloading the page works.
What worked for me was to download ASP.NET Ajax from Microsoft.
You might also need to explicitly browse for the correct dll version when you add reference e.g.
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Web.Extensions.dll
I set Application Pool as ASP.NET 4.0 Classic during installation.
well i just changed RadScriptManger to Simple asp:ScriptManager and it works
Before:
<telerik:RadScriptManager ID="RadScriptManager1" EnableCdn="true" runat="server" />
After
<asp:ScriptManager ID="scrReg" EnablePartialRendering="true" runat="server"></asp:ScriptManager>
Hope it helps
And here's another cause. I installed MySQL Connector/net 6.9.5. Later I started getting the dreaded 'sys undefined' for everything in some, but not all, projects in IE. Many, many hours later I tried Chrome and Opera and the first page opened fine but on post back all the session variables had vanished. That's when the penny finally dropped - Connector/net must have set itself up the session state provider but I had nothing for session state in web.config for the failing projects. Sessionstate inproc fixed it immediately. At least I think that's what happened...
In my case, I had ended up with the mentioned handlers in <httpHandlers> as well as in <handlers>.
Removing the <httpHandlers> section fixed it.
After adding System.Web.MVC reference to my ASP.NET and added default route in global.asax
i.e.
RouteTable.Routes.MapRoute("Default", "{controller}/{action}/{id}",
new { controller = "new", action = "Index", id = "" });
}
Started getting the error
Added below line to global.asax.cs to resolve it
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
For anyone working with the Visual Studio 2015 ASP.NET 4.5 WebForms Web Application project template which bundles the ASP.NET AJAX scripts:
https://stackoverflow.com/a/47673606/313935
for me web config was correct.
if web config is correct then.
check your IIS App pool settings in my case App pool pipeline was selected as the classic I made pipeline integrated and it started working.
Go to iis -> rightclick on your application pool -> advance settings ->
Managed Pipelined Mode -> "integrated" -> ok
I am using Visual Studio 2015 ASP.NET 4.5 Web Forms Web Application project and apparently a bad route in an API Controller will also cause this error. I fixed the route and the error went away.
It certainly would be nice for a more descriptive error message as to why the client framework won't load. I spent hours checking web.config settings, clearing the .net temporary directories, checking global.ascx, etc.. The strange thing is while IE 11 died while loading default.aspx, chrome was able to load default.aspx and the web site.
Try changing on the web.config the compilation to false:
<compilation debug="false" targetFramework="4.5">
If none of these answers work for you then you might be in my situation.
Ok, so for me the issue was caused by the ssl certificate expiring today, so after I renewed it then these errors went away.
I'm using Uploadify Plugin in my webform and get a error Http 302. I dont know how this happen and how to fix it, anybody help me fix it. thank in advance.
Here is my javascript code :
<link href="jscript/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<script src="jscript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="jscript/uploadify/swfobject.js" type="text/javascript"></script>
<script src="jscript/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#custom_file_upload').uploadify({
'uploader': 'jscript/uploadify/uploadify.swf',
'script': 'admin_ServicesPhotosManager.aspx',
'cancelImg': 'jscript/uploadify/cancel.png',
'folder': 'Images/Uploads',
'fileExt': '*.jpg;*.gif;*.png',
'fileDesc': 'Image Files (.JPG, .GIF, .PNG)',
'multi': true,
'queueSizeLimit': 5,
'queueID': 'custom-queue',
'onSelectOnce': function (event, data) {
$('#status-message').text(data.filesSelected + ' files have been added to the queue.');
},
'onAllComplete': function (event, data) {
alert(data.filesUploaded + ' files uploaded successfully !');
window.location = 'admin_ServicesPhotosManager.aspx';
},
'onError': function (event, ID, fileObj, errorObj) {
alert(errorObj.type + ' Error: ' + errorObj.info + " file : " + fileObj.type);
}
});
});
</script>
and my admin_servicephotosmanager.aspx code :
<div id="status-message">
</div>
<div id="custom-queue">
</div>
<input type="file" id="custom_file_upload" name="file_upload" />
<a href="javascript:$('#custom_file_upload').uploadifyUpload();" class="file-upload">
</a>
finally is my admin_servicephotosmanager.aspx.cs code behind :
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Files["Filedata"] != null)
{
HttpPostedFile uploads = Request.Files["Filedata"];
MessageBox.Instance.DisplayMessageAndRefresh(uploads.ContentLength.ToString(), false);
}
}
Update my web.config :
<location path="~/admin_ServicesPhotosManager.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
<httpRuntime executionTimeout="1800"
maxRequestLength="1048576"
useFullyQualifiedRedirectUrl="false"/>
</system.web>
<system.web>
<httpRuntime
executionTimeout="110"
maxRequestLength="102400"
requestLengthDiskThreshold="80"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
maxWaitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false" /></system.web>
somebody help me fix http 302 error . thanks in advance.
The request probably was blocked, check if you have security issue.
Remove
<authorization>
<allow users="*"/>
</authorization>
From your web.config, it will work.