web-config

MaxWebConfigFileSizeInKB and IIS 10

五迷三道 提交于 2019-12-24 03:39:04
问题 I am using a Web application with a web.config file larger than 250KB on IIS 10. In IIS 8.5 and below the registry key HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB (REG_DWORD) could be set to allow web.configs to be larger than 250KB. However it seems that this registry key is not read by IIS 10 any longer. Does anyone know if this key should still work on IIS 10 or how to use config files larger than 250KB in combination with IIS 10? 回答1: I forgot to set

Is there a way to programmatically save values to web.config appSettings without destroying comments and formatting?

喜欢而已 提交于 2019-12-24 03:37:12
问题 This code works, but it destroys comments and formatting in Web.config. Is there a way to write to Web.config that won't destroy formatting? var webConfig = WebConfigurationManager.OpenWebConfiguration("~"); var settings = webConfig.AppSettings.Settings; settings["Foo"].Value = "Bar"; webConfig.Save(); 回答1: Maybe you can open the web.config as a standard xml file and use Xpath to locate the node you want to change. 回答2: You can use Visual Studio API, load Web.config and call Format Document

IIS HTTP to HTTPS web.config rewrite doesn't return entire URL

一笑奈何 提交于 2019-12-24 02:59:14
问题 So I have been trying to rewrite using the following: <rules> <rule name="HttpToHttps" stopProcessing="true"/> <match url="(.*)"/> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true"/> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{URL}"/> </rule> <rules> In two environments, this redirects like it should. In a third environment, it doesn't work. It doesn't work in the sense of, looking at a fiddler log, I see the http call with the full url. When it redirects to

Logic behind data source=(local) in connection string

人走茶凉 提交于 2019-12-24 02:54:13
问题 I have two instances of SQL Server 2008 Express and one instance of SQL Server 2012 on my development machine. We're developing an ASP.NET MVC application and use the expression data source=(local); inside of our connectionString in Web.config. Now my question is what is the logic behind this expression? Which instance gets chosen and how can I change this behavior? 回答1: Using "local" you get the default instance which is usually the non-express SQL Server since by default in SQL Server

blocking spam referer domain with web.config

[亡魂溺海] 提交于 2019-12-24 02:40:50
问题 I'm trying to block spam referer domains with web.config. I have it (mostly) working. Here's the code I'm using: <rule name="abort referer spam requests" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_REFERER}" pattern="(semalt\.com|Darodar\.com|Priceg\.com|7makemoneyonline\.com|Buttons\-for\-website\.com|Ilovevitaly\.com|Blackhatworth\.com|Econom\.co|Iskalko\.ru|Lomb\.co|Lombia\.co|hulfingtonpost\.com|cenoval\.ru|bestwebsitesawards\.com|o\-o\-6\-o\-o\.com

Encrypting Web.config and installing

夙愿已清 提交于 2019-12-24 02:36:04
问题 I am new to the encryption process and have tried unsuccessfully to install an encrypted web.config file onto a hosting companies server. I am using Microsoft Visual Web Developer 2010 Express. I have followed the steps located in Walkthrough: Encrypting Configuration Information Using Protected several times. Please Note regarding the walkthrough, I do not have any machineKeys in my web.config file, so I skipped that encryption step. When I Ran the aspnet_regiis -pef connectionStrings "c:

restart website in IIS when changing values in the appSettings of the web.config

回眸只為那壹抹淺笑 提交于 2019-12-24 02:09:45
问题 Just to be safe, when I make changes in the values of the appSettings in the Web.config I always restart the WebSite so all the changes can be refreshed. But do I really need to restart it? how is IIS handling the appSetting values, is it reading the values in one time (once you start the application) or is IIS reading it every time a client is accessing the website? 回答1: Actually, it is not the "Website" but the "App Pool" that needs the restart. Remember the website pipeline in IIS has no

Fire events for requests to static content without setting runAllManagedModulesForAllRequests to true

为君一笑 提交于 2019-12-24 00:57:58
问题 I'm looking for a more precise solution to handle requests for static contents by the ASP.NET lifecycle without setting runAllManagedModulesForAllRequests to true. As far as I know is the effect of runAllManagedModulesForAllRequests = "true" that the precondition attribute of each module will be set to "" . The problem: I have to protect static content in a subfolder of a web application against unauthorized access To include requests to those static contents in the ASP.NET lifecycle and

Web.config - ConnectionString property has not been initialized

大兔子大兔子 提交于 2019-12-23 18:04:16
问题 I have a number of ASP.NET applications which run fine for months, then stop dead with the message: "....ConnectionString property has not been initialized". The application uses strongly typed datasets, with the connection string stored in the web.config file. If you just search the web for the message in the subject, you get all sorts of answers relating to incorrectly configured web.config files. In this case, however, the connection works - then randomly stops working. The resolution, I

Edit Settings in web.config

怎甘沉沦 提交于 2019-12-23 17:23:50
问题 I didn't know how to title this question - I am making a request to PayPal's Express Payment API. I'm using their dll that helps make the request and parse the response. The instructions for their code to work is to add you authorization credentials in the web.config file. I have done so. My problem is that I want to be able to edit these credentials that are being set dynamically (probably got from SQL) because we are going to allow different users to enter their API credentials. Sending the