my web.config is as
<?xml version="1.0" encoding="utf-8"?>
<!--
Web.config file for first.
The settings that can be used in this file are documented at
http://www.mono-project.com/Config_system.web and
http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
-->
<configuration>
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<add assembly="System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<customErrors mode="Off"/>
<authentication mode="None">
</authentication>
<authorization>
<allow users="*" />
</authorization>
<httpHandlers>
</httpHandlers>
<trace enabled="true" localOnly="true" pageOutput="false" requestLimit="10" traceMode="SortByTime" />
<sessionState mode="InProc" cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<pages>
</pages>
</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>
when I run it
it gives me an error like \
Application Exception
Runtime Error
A runtime error has occurred
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed (for security reasons).
Details: To enable the details of this specific error message to be viewable, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
A quick search using Google reveals:
CustomErrors mode="Off"
Basically you need to adjust a few other settings
Related
I am using Intelligencia URL rewriting, but those pages is not redirecting and showing error 404. While I have installed rewrite module on server. Please suggest me what is mistake I am doing. My web.config file is below..
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
</configSections>
<appSettings/>
<connectionStrings>
<add name="connStr" connectionString="Data Source=INV-DEV-SQL2K5;Initial Catalog=WidenerPortal;Persist Security Info=True;User ID=widener;Password=widener123a" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</httpModules>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<rewriter>
<rewrite url="~/Article/(.+)-(.+).aspx" to="~/DynamicPage.aspx?MyTitleId=$2"/>
</rewriter>
</configuration>
First of all add Intelligencia.UrlRewriter dll reference in your
asp.net application and than below setting in your web.config file:
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</httpModules>
</system.web>
<rewriter>
<rewrite url="w1" to="WebForm1.aspx" />
<rewrite url="w2" to="WebForm2.aspx" />
</rewriter>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</modules>
</system.webServer>
Try it with call your page with new url like webform2.aspx as w2. It will work fine
Use this. Mode=RemoteOnly redirect when you access from another host
<customErrors mode="On" defaultRedirect="GenericErrorPage.htm">
or visit http://urlrewriter.net/index.php/support/reference/error-handler/error-page
Hi I'm trying to run dotless on my local .net4 web site
My web config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers><add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" /></httpHandlers></system.web>
<dotless minifyCss="false" cache="true" web="false" />
<system.webServer>
<handlers>
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
</system.webServer>
</configuration>
Here is the error I get
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
This application defines configuration in the system.web/httpHandlers section.
Can you please help?
adding <validation validateIntegratedModeConfiguration="false"/> worked
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
</system.web>
<dotless minifyCss="false" cache="true" web="false" />
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
</system.webServer>
</configuration>
<validation validateIntegratedModeConfiguration="false"/> tells IIS to ignore configuration issues. One such issue seems to be the fact that dotless automatically adds a handler to system.web and system.webServer. The former section is used by the classic application pool mode, whereas the latter by the new integrated application pool mode. Since I am using the integrated mode, removing the handler in system.web helped just as well.
I had to add <validation validateIntegratedModeConfiguration="false"/> to my webserver section and I also had to move the configSections to be the first element in my Configuration.
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
We will add a small piece of code into web.config file. open web.config from your IIS root or change the setting in Visual Studio web.config and publish again.
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
When using the April 2013 AjaxControlToolkit I receive the error:
0x800a139e - JavaScript runtime error: error raising upload complete event and start new upload
When trying to upload a file using the AjaxFileUpload control.
Make sure the following stuff should be present in web.config.
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="42949672" />
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
To resolve the error you need to add this
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>
in your
<system.web>
section of your web.config
If your app pool is set to classic then this happens unless you use precondition=”integratedMode” added to httphandler for system.webserver
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" preCondition="integratedMode"/>
Had the same issue after switching to 4.5. The suggested solution didn't worked until I added full assemply name:
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit, Version=4.5.7.725, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E" />
</httpHandlers>
Turns out, if you have the 3.5 version in the "old" gac, and 4.5 in the new Microsoft.net/assembly gac, your webapp (IIS?) will not choose the right one!?
Since my application uses forms authentication, I added this to my web.config in order to put the ajaxfileupload to work:
<location path="AjaxFileUploadHandler.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
If anyone still facing the issue even after the changes said by #sridharnetha try to include the below lines.
Important to add UseAbsoluteHandlerPath ="false"
<ajax:AjaxFileUpload ID="AjaxFileUpload11" runat="server"
MaximumNumberOfFiles="3" AllowedFileTypes="txt,xls,xlsx,doc,docx,pdf"
Width="400px" UseAbsoluteHandlerPath ="false"
OnUploadComplete="OnUploadComplete"
OnClientUploadStart="UploadStart"
OnClientUploadCompleteAll="UploadComplete"
ClearFileListAfterUpload="true"
OnClientUploadError="UploadError"/>
In Web.config
<httpHandlers>
<add verb="*" path="http://localhost/AjaxFileUploadHandler.axd"
type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" />
</httpHandlers>
I'm running into a strange issue. I have a .Net application deploying to Azure which is using Azure ACS for authentication. While the project is set up as a web application, we are primarily serving static .html and .js files. The problem is that the user is redirected to authenticate through ACS ONLY when they visit our root url directly.
For example, I have this set up locally through the Azure emulator. If the user goes to 127.0.0.1:81/ they are redirected to log in, but if they go directly to 127.0.0.1:81/Index.html, they are able to load up the page without being redirected to ACS. (although subsequent .js calls during the page load to a .svc service fail)
Here is my web.config file:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<location path="FederationMetadata">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.web>
<httpRuntime requestValidationMode ="2.0"/>
<authorization>
<deny users="?" />
</authorization>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
<connectionStrings>
<add name="ExperienceBrowserEntities" connectionString="metadata=res://*/ExperienceBrowser.csdl|res://*/ExperienceBrowser.ssdl|res://*/ExperienceBrowser.msl;provider=System.Data.SqlClient;provider connection string="Data Source=tmbwb1mnyn.database.windows.net;Initial Catalog=ExperienceBrowser;Persist Security Info=True;User ID=ExperienceBrowserUser;Password=XXXXXXXX;MultipleActiveResultSets=True;Application Name=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<appSettings>
<add key="FederationMetadataLocation" value="https://appCentral.accesscontrol.windows.net/FederationMetadata/2007-06/FederationMetadata.xml" />
</appSettings>
<system.webServer>
<modules>
<add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
<add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
</modules>
</system.webServer>
<microsoft.identityModel>
<service>
<audienceUris>
<add value="http://127.0.0.1:81/" />
</audienceUris>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="https://appCentral.accesscontrol.windows.net/v2/wsfederation" realm="http://127.0.0.1:81/" requireHttps="false" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
<applicationService>
<claimTypeRequired>
<!--Following are the claims offered by STS 'https://appCentral.accesscontrol.windows.net/'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.-->
<claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" optional="true" />
<claimType type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" optional="true" />
<!--<claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" optional="true" />-->
<!--<claimType type="http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider" optional="true" />-->
</claimTypeRequired>
</applicationService>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="D6DAB54F4A47E88FFF206E6796A3367DA6033B0C" name="https://appCentral.accesscontrol.windows.net/" />
</trustedIssuers>
</issuerNameRegistry>
<certificateValidation certificateValidationMode="None" />
</service>
</microsoft.identityModel>
</configuration>
Think you need to add those extensions to be processed by ASP.NET in IIS. This answer is not based on Azure. I had to do this with regular IIS and ASP.NET. If it does not work the same in Azure please let me know and I will delete the answer.
"The mapping of file name extensions to ASP.NET is done in Internet Information Services (IIS). By default, .aspx pages are run by ASP.NET and .htm and .html pages are not."
ASP.NET Web Page Syntax Overview
I wrote a httphandler to handle all XSLT requests.
The name of the handler is XSLTHandler.cs.
web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add verb="*" path="*.xsl" type="XSLTHandler" />
</httpHandlers>
</system.web>
</configuration>
I got this error message, dont know how to fix it.
Configuration Error Description: An error occurred during the
processing of a configuration file required to service this request.
Please review the specific error details below and modify your
configuration file appropriately.
Parser Error Message: Could not load type 'XSLTHandler'.
What you're missing is the assembly and namespace that XSLTHandler belongs in, from MSDN. So if it's located in your current project, it should look like this:
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.xsl"
type="WebApplicationName.XSLTHandler, WebApplicationName" />
</httpHandlers>
</system.web>
</configuration>
The MSDN link shows how to configure for both the classic and integrated modes
https://msdn.microsoft.com/en-in/library/ms228090(v=vs.80)
Note that you need to provide the proper namespace of the handler you are using
Example:
<configuration>
<system.web>
<!--Classic-->
<httpHandlers><add verb="*" path="*.sample" name="HttpHandler" type="Handler.kHttpHandler"/></httpHandlers>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<!--Integrated mode-->
<handlers><add verb="*" path="*.sample" name="HttpHandler" type="Handler.kHttpHandler"/></handlers>
</system.webServer>
</configuration>