I defined a WebApi which takes the credetianls from the browser, it works.
After deploying it I have to edit the Authentication on the server from Anonymouns to Windows. I tried to add <authentication mode="Windows"/> to the Web.Config.Release but it doesn't change...
Why? Suggestions?
The .Release.Config file is not a .Config file as such - it's a file that describes how to transform the default Web.Config file into a new Web.Config file for release.
So, you don't simply add nodes to it - you need to specify the modifications you want to make using the defined syntax for this - see https://msdn.microsoft.com/library/dd465318(v=vs.100).aspx
In your case, you probably want something like:
...
<system.web>
<authentication mode="Windows" xdt:Transform="SetAttributes" />
</system.web>
...
Related
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.
Hey i have an mvc app that i have published in my azure server. I get an error when i try it in the server. In localhost in works fine. But in the server i get an error that looks like this
So my question is how can i remove that custom error. I want to see the error message that explains what the error is about?
i want the error message to be like this one
check if you have this line this line in your web config system.web area
<customErrors mode="Off" />
if you do change it to off and if not add it in
You can use web.config transform file (such as Web.Debug.config or Web.Release.config) and include the following section:
<system.web>
<customErrors mode="Off" xdt:Transform="Insert" />
</system.web>
The Web.config file will be transformed when you deploy to Azure. The transform does not occur locally.
I am hoping to separate the Identity config in the system.web section of my web.config and put it in a separate file so that I don't have to check in to source control the username/password being used.
Is this possible? It looks like the file attribute doesn't work for the system.web section and even if the configSource attribute would work, I wouldn't want to have all of the system.web config section in a different file.
Can anyone help?
Thanks!
A bit more research has revealed that while we can't use configSource or file attributes on the <System.Web> section, you can use it on the tags within it.
For example, I wanted to move our globalization settings out of web.config into globalization.config, and so we changed our web config from this:
<system.web>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto" />
<!-- Other settings removed -->
</system.web>
to this
<system.web>
<globalization configSource="globalization.config" />
<!-- Other settings removed -->
</system.web>
As the question suggest is it possible to change the maximum request length in an asp.net mvc project without modifying the web.config file?
The project is on several client servers which I don't want to have to manually change for each one so hoping I can put something in global.asax to write it instead or similar?
EDIT:
OR is it possible to add another config file with just the settings I want to overwrite?
I don't think that's possible, as the web config stores the configuration values that your application uses to define how it behaves - in this case, the length of the data you require to be passed on.
You would need to modify the web.config as follows:
<configuration>
<system.web>
<httpRuntime maxRequestLength="1048576" />
</system.web>
</configuration>
And if you are on IIS7 above, the following needs to be configured as well:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
Additional Note: maxAllowedContentLength is measured in bytes while maxRequestLength is measured in kilobytes
Some options you have are:
Powershell script that would read your web.config files on the different servers and update the configuration values accordingly.
Uploading the web config directly via FTP or publish.
Modifying the web config directlyon the server instance.
I am using file upload controller for uploading documents.Here when I'm using files of size say 30mb I'm getting an error saying
"The connection to the server was reset while the page was loading.".
Its not even going to the upload button click event.
File upload controller working fine for files having smaller size.
I'm uinsg VS2005 and C#.
you have to use httpruntime module for that, Use MaxRequestLength Property, in the configuration section of web.config file.
MaxRequestLength Property you may use code like this,
<configuration>
<system.web>
<httpRuntime maxRequestLength="31457280" executionTimeout="36000" />
</system.web>
</configuration>
add this to your web config
<configuration>
<system.web>
<httpRuntime maxRequestLength="31457280" />
</system.web>
</configuration>