Server Error in '/' Application in c# - c#

<system.web>
<customErrors mode="off" defaultRedirect="~/Contents/error.aspx">
</customErrors>
<sessionState mode="InProc" cookieless="UseCookies" timeout="20">
</sessionState>
</system.web>
Added system web.config code.i changed to
customErrors mode="on".still same error.please check these code as well. can anyone help me to solve this error.

If you read the error, it tells you that the attribute needs to be "RemoteOnly, On, Off". You need to change the attribute mode="off" to mode="Off".

Related

Runtime Error after deploy asp.net webforms app in Microsoft Azure App service

I am trying to deploy in Azure WebApp service an ASP.NET Weforms.
The app runs fine locally, without any problem.
After build ends I got the error below error in web browser after i go to myapp.azurewebsites.net i
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".
Here is source of Web.config file
<?xml version="1.0"?>
<configuration>
<configSections/>
<connectionStrings>
<add name="constr" providerName="System.Data.SqlClient" connectionString="server=telendar.database.windows.net; database=TrackerDB;uid=telendar;password=*****;"/>
</connectionStrings>
<location path="Admin">
<system.web>
<customErrors mode="On"/>
<authorization>
<allow roles="Administrator"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<system.web>
<compilation debug="true" targetFramework="4.5.1"/>
<sessionState timeout="60"/>
<authentication mode="Forms">
<forms defaultUrl="~/Default.aspx" loginUrl="~/AuthUser.aspx" slidingExpiration="true" timeout="60"/>
</authentication>
<authorization/>
<pages controlRenderingCompatibilityVersion="4.0" validateRequest="true">
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
</controls>
</pages>
</system.web>
</configuration>
You misunderstand the error message, it's telling you that your code crashed an unhandled exception and it's not allowed to show it ,it suggest you modifying the web.config to enable the details of the specific error message to be viewable on remote machines.
So what you need to do is recreate the error while you browse it on the server and then solve the problem.
However my suggestion is you could try to change your FrameWork maybe this will work for you.
If you still have other questions, please let me know.

Getting Access denied in asp.net core application

I published API who execute DLL into IIS asp.net core application where I'm getting access denied to my files. I read a lot of forums about this error:
To execute DLL in webconfig I have:
<add key="myFile" value="D:\WebSites\business.myapi.WebApi\Web\App_Data\bin\myfile.NCD" />
In WebConfig I try adding:
<system.web>
<authorization>
<allow users="*" />
</authorization>
<customErrors mode="True" />
<trust level="Full" />
<compilation targetFramework="4.7" />
<httpRuntime targetFramework="4.7" />
<identity impersonate="false" />
<authentication mode="Windows" />
</system.web>
Also I set IIS_IUSRS user with full permisions and .NET Trust Levels are setted to Full (internal)
Nothing works, I'm really desesperated.
Error:
Exception: System.Security.SecurityException: Access is denied. at ...
The Zone of the assembly that failed was: MyComputer Inner Exception:
Access is denied.
Someone have an idea why this issue still appearing after add permissions?

How do I fix the custom errors?

I keep getting this error when trying to run my system
<system.web>
<customErrors mode="Off"/>
</system.web>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.html"/>
</system.web>
First of all, enable the details of this specific error message by putting the "customErrors" tag in your "web.config" file like this:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Now you will get the exact error in your code and you can fix that specific error.
For security reasons, your code will not be shown in the browser for end user until you have not enabled CustomError mode="Off" in web.config file.
For security reasons .NET-Websites shows complete exceptions only, if you call them locally. To see the error message you have to choices:
Call the website through a browser on the Server (of course not possible, if you deploy to a Azure WebApp, but e.g. in a VM)
Add the first of your snippets (customErrors mode="Off") to your web.config. Then you'll see the complete exception even remotly over the network. My advice would be to set it back to the default setting after you've seen and fixed the error.

Configuration error: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

I have developed a web application using c# and asp.net but when I am trying to publish and put it into the server using ftp then I am getting this following error:
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: It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS.
Source File: \\fs8-n02\stor10wc2dfw1\555713\570520\www.gxxxxjjsxx.ssd\web\content\2way\armb
\web.config Line: 9
Here if I check on my Line 9 of the web config file then I get this:
<authentication mode="Forms">
And here is my complete web config file code:
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="2880"/>
</authentication>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages validateRequest="false">
<controls>
<add tagPrefix="ajaxtoolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolKit" />
</controls>
</pages>
<globalization culture="en-GB"/>
</system.web>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>
I have checked whether I have multiple web config files but I could not find something like that. And also I have used this published folder into my IIS and I can browse the site from my localhost using IIS but still when ever I am trying to browse using the link:
I am getting the same error. Please help me on this. Thanks.
Here is my solution to the problem: Actually the path was not configured properly into the IIS as a virtual directory. So, that I had to create a proper virtual directory and then only I am able to access the site.

IIS Error for custom messages

Please find attached the error I am getting while trying to display a custom error message. My application ASP.Net 4 and uses IIS 7.5. HEre is my code in web.config.
</httpErrors>
You should have your this under system.web
<system.web>
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/ErrorPages/WebError.aspx"/>
And this under system.webServer (one of a few options)
<system.webServer>
<httpErrors existingResponse="PassThrough"/>

Categories