web-config

Clean Web.Config file in Asp.NET 4.0?

痴心易碎 提交于 2019-12-24 15:26:28
问题 Okay, I am wondering having clear web.config file could be good but you know some shared web hosting companies don't allow us to touch things like machine.config and etc. So If a lot of things have been moved onto machine.config, then will we be allowed to change things like we used to through web.config file. 回答1: Nothing is changing in this regard with ASP.NET 4.0: the way the ASP.NET configuration model has always worked is that you can override settings in machine.config with a web.config

Error with Membership CreateUser

别说谁变了你拦得住时间么 提交于 2019-12-24 13:59:57
问题 I am creating a new user programmatically (will be adding custom profiles later) and am working on Win2K8 VM: MembershipUser newUser = Membership.CreateUser(userNameTxt.Text, passwordTxt.Text, emailTxt.Text); Roles.AddUserToRole(userNameTxt.Text.Trim(), "Member"); UPDATE: Connection string: <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Initial Catalog=MYS;Data Source=WIN2K8;uid=MYS;password=xxxxxx;" providerName="System.Data.SqlClient" /> Getting the following

NUnit not picking up the database connection string

浪子不回头ぞ 提交于 2019-12-24 13:34:12
问题 I have a project( SLR ) and an Nunit test project( SLR.Tests ) Every test of a method that interacts with the database fails with an "object not set to an instance of an object" exception on the line using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["isvConnectionString"].ToString())) Hard coding the connection string into the new statement works as expected, and calling the method in course of running the SLR project does not throw any exceptions. Therefore

Changing .net Membership ConnectionString

坚强是说给别人听的谎言 提交于 2019-12-24 11:34:56
问题 I need to change the connection string that the .net Membership API uses. Basically the API loads the connection string from app.config on the first time you are calling it. Does anyone knows how can I dynamically tell the API to use a different connection string? <system.web> <membership defaultProvider="SqlProvider"> <providers> <clear /> <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MySqlConnection" enablePasswordRetrieval="false"

Web.config entry to connect to SQL Server

泪湿孤枕 提交于 2019-12-24 11:27:51
问题 Well I'm trying to change the connection of my application from Oracle to SQL Server. I have this in web.config. <compilation debug="true"> <assemblies> ... <add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> ... </assemblies> </compilation> and <appSettings> <add key="DatabaseProvider" value="Test.App.Oracle8i"/> <add key="SmtpUser" value="mail@example.com"/> <add key="SmtpPassword" value="testpassword"/> <add key="SmtpDefaultSender"

AJAX toolkit and web config security

余生颓废 提交于 2019-12-24 10:44:42
问题 I'm using ASP.NET and the AJAX toolkit and was wondering if there are any security aspects I should be concerned about. I've never used the AJAX toolkit before, and usually from standard controls, there are postbacks which I use to validate input. I assume this is the same with the AJAX controls, but are there any extra catches that might be missed? Also, I've set some security aspects in my web.config files. As I understand it, anything set in parent folders, cascades down to subfolders.

Unable to write AppSettings of web.config on production server

心不动则不痛 提交于 2019-12-24 10:17:01
问题 I've written following code to make changes to the values of AppSettings in the web.config and when I tested it on my dev machine, it works fine. However, after I've copied the page to the production server, changing the values are not updated. Configuration myConfig = WebConfigurationManager.OpenWebConfiguration("~"); try { myConfig.AppSettings.Settings["username"].Value = txtUsername.Text; myConfig.AppSettings.Settings["password"].Value = txtPassword.Text; myConfig.AppSettings.Settings[

Unable to find connection 'MyConnName' for object 'Web.config' in Table Adapter configure Properties

假装没事ソ 提交于 2019-12-24 08:32:06
问题 I want to change the query in table adapter but it's not opening & throwing an error " Configure table Adapter Failed " & in property of connectionString it says " Unable to find connection 'ConnStringName' for object 'Web.config'. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded " 回答1: I have been looking for a solution for this problem for a long time. Thankfully I found a solution that worked

App.config only for my developer machine

我怕爱的太早我们不能终老 提交于 2019-12-24 08:27:41
问题 Can I create app.config or web.config file that applies only to my developer machine, as opposed to using the default configuration files that are checked into source control? 回答1: You can have an app.config for each environment, if is this what you are looking for. Try this: http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx 回答2: I would recomend using separate config files that are referred to by your app.config or web.config. For example in

Tokenization based pattern replacement in web.config.token

时间秒杀一切 提交于 2019-12-24 08:10:07
问题 I am using Release Manager 2015 to deploy my application. I am using Microsoft's Extension Utilities pack to do this: Extension Utility Pack - Documentation This simply states: Tokenization based pattern replacement This task finds the pattern __<pattern>__ and replaces the same with the value from the variable with name <pattern>. Eg. If you have a variable defined as foo with value bar, on running this task on a file that contains __foo__ will be changed to bar. So in my web.config.token