ASP.NET Terminating due to Timeout - c#

The script crashes over timeout. Where can I customize? I understand that in the application itself in web.config you need to register something like
<system.web>
<httpRuntime executionTimeout="10000" />
</system.web>
If I understand correctly, then I don’t understand where exactly to put this tag?
I have this structure in web.config
configuration
location
system.webServer
security
handlers
aspNetCore

You can configure this sitewide as a child of the configuration node.
https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/web/
You can also configure them with more granularity, as a child of your location node(s)
<location path="foo">
<system.web>
<!-- Set execution timeout to 6 minutes -->
<httpRuntime executionTimeout="360" />
</system.web>
</location>

Related

A potentially dangerous Request.Path value was detected from the client (<)

I first searched for this issue on stack & some other sites & implemented solution in web.config file but still getting the error..
My web.config
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5.2"/>
<httpRuntime requestPathInvalidCharacters="<,>,*,%,&,:,\,?" targetFramework="4.5.2" requestValidationMode="2.0"/>
<customErrors mode="Off"/>
<trust level="Full"/>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Runtime.Serialization"/>
<add namespace="System.ServiceModel"/>
<add namespace="System.ServiceModel.Web"/>
</namespaces>
</pages>
</system.web>
I am trying to get Iframe source values from my db table. It's google map I want to include in my page..
This error signals that you are issuing web request with '<' character, and Asp.Net has some prevention against using potentially malicious characters. You should probably set
<system.web><httpRuntime requestPathInvalidCharacters="" /><pages validateRequest="false" /></system.web>
See also http://www.christophercrooker.com/use-any-characters-you-want-in-your-urls-with-aspnet-4-and-iis
But keep in mind that you are switching off functionality that exists to make it harder for attackers to break your web application. So, if I were you, I would first think if I can change the app to not use forbidden chars in URLs

HttpException (0x80004005): Request timed out ASP.Net

I just want to ask if theres a way to increase the executionTimeOut of a particular page? and not the whole application?
<configuration>
<system.web>
<httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false"
minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
</system.web>
</configuration>
Page.Server.ScriptTimeout = 90;
Or
use location element in config file
<configuration>
<location path="UploadPage.aspx">
<system.web>
<httpRuntime executionTimeout="90" maxRequestLength="4096" />
</system.web>
</location>
</configuration>
See To Increase Request Timeout only on particular Web Page and Increase ASP.Net timeout on a per page level
put in Web Config File
<location path="Report.aspx">
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="10240"/>
</system.web>
</location>

I want to disable requiring authentication for one MVC controller action

I have created an mvc application I don't want authentication for one functionality in my application. I want that the user should able to open the page from the URL without log in.Right now if I enter the URL to open that functionality directly then it will take me to the sign on page. I want to bypass the authentication process in one functionality.
I have tried following code in my web.config.
<location path="ControllerName">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
And I have also added [AllowAnonymous] attribute to the some action of my controller.
The following code that i have written for authentication in my web.config.
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthentication"/>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
<remove name="AuthorisationModule"/>
<add name="AuthorisationModule" type="ProjectName.AuthorisationModule(which is for autentication), Project Name"/>
</modules>
There is an authentication for the whole application and I want discard the authentication of just one feature of my mvc application. So I have added the following code in my web.config
<location path="ControllerName">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
So using this code it's working fine.
Something that may help with your issue is the fact that you can have multiple web.config files -- if you put a web.config in a subdirectory within your project, then you can include configuration options specific only to that subdirectory. As such, you may want to try adding a subfolder to contain just the controller which you want to make publicly available, and then creating a separate web.config file allowing open access to that subdirectory. As per this answer regarding wildcards in web.config files, here is example code that should suffice as a standalone web.config to provide
<?xml version="1.0"?>
<configuration>
<system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</configuration>
That way you don't have to mess around with specifying the one controller or action you want to give access to, as the distinction is made by the organization of the files in the directory structure.

Runtime Error on IIS

Server Error in '/educational/timecalculator' Application.
Runtime Error
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 remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, 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>
This website was working before but was moved over to IIS and now getting this error. The webpage will run locally but not remotely. Perhaps the .NET framework isn't 4.5 on IIS?
This is my Web.config file in asp.net
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
In IIS verify that the Application Pool for the website is set to use the correct .NET Framework.

blank asp.net site shows web.config error when i try to access it

I have created a blank asp.net website consisting of a blank default.aspx page, its .cs file, a login.aspx page and its .cs and a web.config. I'm looking to test .net authentication as seen in here on the MSDN site. I've copied everything as shown in the article. I set up the site in IIS6 now when I go to the site I get the runtime error with the:
"To enable the details of this specific error message to be viewable on remote machines, 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"."
message. when I add the customErrors mode="On" tag to the web.config I still get this error like its not looking at the web.config. I've triple checked IIS and its definitely looking at the right site folder. Here's my web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="On"/>
<authentication mode="Forms">
<forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH">
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
<compilation debug="false" targetFramework="4.0" />
</system.web>
</configuration>
I usually set sites up through CMS installations. This is the first time I've done one from a blank site in visual studio. Is there more you need to add to web.config?
set
<customErrors mode="Off"/>
to see the actual error.
You need to set
Not "On" to see the actual error with stacktrace.

Categories

Resources