web-config

IIS htaccess rule converter only importing 1 rule

我怕爱的太早我们不能终老 提交于 2019-12-31 06:13:30
问题 I have a example .htaccess file (found here) with bad robots to block. Here's a small sample code block from that file: #bad bots start #programmed by tab-studio.com public version 2017.12 #1 new rule every 500 entries RewriteCond %{HTTP_USER_AGENT} \ 12soso|\ 192\.comagent|\ 1noonbot|\ zuibot|\ zyborg|\ zyte\ [NC] RewriteRule .* - [F] #bad bots end Basically throwing a 403 on a URL match. I checked this post to see how I can convert these .htaccess rules to a web.config rewrite rule via IIS.

Is it possible to allow anonymous user to browse only few files from a folder

孤者浪人 提交于 2019-12-31 04:22:06
问题 I want to allow anonymous users to browse only few files like default.aspx, aboutus.aspx, contactus.aspx etc. Is there a way to write all these file names in one place or I will have to repeat the below code again and again for all the files? <location path="Default.aspx"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> 回答1: It is not possible to specify multiple paths in a single location element. I think you are asking to do is something like this: <location

Is it possible to override both appSettings and connectionStrings in a Local.config file?

佐手、 提交于 2019-12-31 03:59:47
问题 We presently override appSettings from our web.config in a Local.config file for each developer. However we also need to override connection strings, so we access our local copy on our machine while the web.config might reference the production server. I know that you can override appSettings by specifying file="Local.config" , but is this possible for the connectionStrings as well? We already make use of an external file for the connection strings but this file has all three connection

Different configuration files for development and production in ASP.NET application

試著忘記壹切 提交于 2019-12-31 02:13:52
问题 On a project I'm working on we have a web application with three configuration files; Web.Config Web.Config.TestServer Web.Config.LiveServer When we release to the test server, Web.Config is renamed to Web.Config.Development and Web.Config.TestServer is renamed to Web.Config, making that configuration active for the application. It is quite onerous keeping three very similar configuration files up to date, and this system is used across a number of applications which are part of this project;

Applying web.config transformations locally

爷,独闯天下 提交于 2019-12-30 18:50:14
问题 I have a transform for my web.config that currently works if I publish to Azure, but it's not working locally when I build/run. How can I go about "Publishing" locally so the Local transformations are applied to my web.config on my dev box? Currently I right-click > publish to Azure, do I need to create a new publish profile for my local box? Is there any way to get the transforms to work on Build instead? 回答1: It depends on which dev server you are using. As @Citronas said on this answer: It

Setting folder default page in aspnet

坚强是说给别人听的谎言 提交于 2019-12-30 17:24:30
问题 My question is really simple. I have a Web application with multiple sub-folders and there's no Default.aspx page in any of these. How do I set the default page in each of these folders so users can type /folder instead of /folder/login.aspx? Can this be done through the web.config file? Should I just rename the file in each folder to Default.aspx? Thanks! 回答1: There is a default document section for web.config, and you can even put a web.config in each folder, and inside that config just

ASP.NET Membership Roles Web.config settings

假装没事ソ 提交于 2019-12-30 11:12:13
问题 I want to understand how the system.web authorization tag on the web.config works, and what exactly each attribute and property does. For instance, what does <system.web> <authorization> <deny users="?"/> <allow users="*"/> </authorization> </system.web> Specifically what I want to do is to disallow access to most of the site for unauthenticated users, allow access to some of the site for authenticated users who belong to a certain role, and allow full access to users from a second role. 回答1:

How to get configuration element

我是研究僧i 提交于 2019-12-30 08:53:28
问题 Helo Can anybody explain me how to get configuration element from .config file. I know how to handle attributes but not elements. As example, I want to parse following: <MySection enabled="true"> <header><![CDATA[ <div> .... </div> ]]></header> <title> .... </title> </MySection> My c# code looks like this so far: public class MyConfiguration : ConfigurationSection { [ConfigurationProperty("enabled", DefaultValue = "true")] public bool Enabled { get { return this["enabled"].ToString().ToLower(

Do I have to add “<%@ Register assembly=” to every page?

倖福魔咒の 提交于 2019-12-30 08:14:37
问题 I upgraded DevExpress components but in my application I have to change every <%@ Register assembly="Dev....... version=.... line in every page. Is there any way to do this without putting same lines to every page? Can't I do this in web.config page? <%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %> 回答1: yup, see http://weblogs.asp.net/scottgu/archive/2006/11

Custom Error Page does not show even though I set CustomError=“On”

雨燕双飞 提交于 2019-12-30 06:20:48
问题 I am using Visual Studio 2012 with the MVC 4 Framework and would like to see the friendly error page of the shared folder, if an exception is unhandled. (I know, as a develepor I need to see the error details but I just wanted to test this setting) So far I know that adding the following code in the system.web section of web.config should do the trick <customErrors mode="On" /> Unfortunately instead of my friendly error page I get this: Server Error in '/' Application. Runtime Error