When I'm send to server 'multipart/form-data' request, ASP.NET return 100 HTTP (continue). I'm want disable this behavior. How do this?
In App.Config, add
<configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
</configuration>
Related
I recently put a basic site out on GoDaddy, and for obvious reasons, I don't want it caching the HTML files. JSON files and other resources are fine, but not the initial HTML files themselves.
This site was hand-coded in Notepad++; WordPress was not used.
On my local IIS server, the caching for HTML files was disabled without much trouble. This is the web.config file for the overall site:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="iisstart.htm" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
</files>
</defaultDocument>
<caching>
<profiles>
<add extension=".html" policy="DisableCache" kernelCachePolicy="DisableCache" />
</profiles>
</caching>
</system.webServer>
</configuration>
The addelement under caching/profiles works just fine on my IIS server when testing locally. However it's been noticed that it is effectively getting ignored on GoDaddy / Plesk.
So my question is: What do you have to do to get GoDaddy / Plesk to go ahead and stop caching the HTML files?
Try to add below code in your web.config file:
<caching>
<add extension=".html" policy="DontCache" kernelCachePolicy="DontCache" />
</caching>
when you try to access site hard refresh the browser and check that is it working or not.
You could refer this link for more detail.
I was trying to add third party web service reference in my application, got proxy error. when I uncheck IE proxy setting then htttps service reference is getting added, but still could not run my application. I tried adding proxy setting in web config file but no luck. Could any one suggest me.
assuming you just call a web service
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="True" bypassonlocal="True"/>
</defaultProxy>
</system.net>
If you are having a WCF Client then set
BasicHttpBinding.ProxyAddres
Thanks. It works. I just tryied this and it works.
<system.net>
<settings>
<ipv6 enabled="true"/>
<servicePointManager expect100Continue="false"/>
</settings>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="True" />
</defaultProxy>
Very strange thing; I'm using the following in web.config file to redirect everything from one domain to specific page on another domain:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://www.example.com/my-page.html" />
</system.webServer>
</configuration>
However, trailing slash is appended to the URL, resulting in a 404:
http://www.example.com/my-page.html/
How can I force redirect WITHOUT the trailing slash?
Thanks!
add exactDestination="true" to your config. It should look like this
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://www.example.com/my-page.html" exactDestination="true" />
</system.webServer>
</configuration>
I have a file (called 'log.html') on my iis7.5 server that I would like my PHP installation to be able to access and write to, but I do not want anybody to access the file directly, for example typing in 'http://computername/log.html' (I am on a LAN).
How can I prevent users from accessing it but allow php to see it?
When using the web.config file suggested below, I get this error:
You can use IIS URL Rewrite and create a Request Blocking Rule to prevent access over HTTP:
For example:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="BlockLogFile"
patternSyntax="Wildcard"
stopProcessing="true">
<match url="*" />
<conditions>
<add input="{URL}" pattern="/log.html" />
</conditions>
<action type="CustomResponse"
statusCode="403"
statusReason="Forbidden: Access is denied."
statusDescription="This is sekret!" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I think that I may have answered my own question! I still need to test it a bit more, and perhaps if it does not work completely then someone could correct me:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="cache-control" value="no-store, no-cache, must-revalidate, max-age=0" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
<security>
<requestFiltering>
<denyUrlSequences>
<add sequence="log.html" />
</denyUrlSequences>
</requestFiltering>
</security>
</system.webServer>
</configuration>
The cache control bit prevents the browser from caching anything that it returned.
Hope this helps somebody else! I am still very new to this, so you might be able to get around this.
I have an MVC2 C#.Net web app using VS2010. Below is an entry in y web.config:
<configuration>
<applicationSettings>
<BOE.My.MySettings>
<setting name="AppBackColor" serializeAs="String">
<value>AntiqueWhite</value>
</setting>
</BOE.My.MySettings>
</applicationSettings>
</configuration>
However, in my Controler.cs file My.Settings.AppBackColor is unrecognized. Any ideas?
var backColor= My.Settings.AppBackColor
What am I doing wrong here?
That's Desktop application stuff. In web applications you don't use such settings.
You could use the <appSettings> section of your web.config to store custom values:
<appSettings>
<add key="foo" value="bar" />
</appSettings>
and then when you want to read foo:
var foo = ConfigurationManager.AppSettings["foo"];