web-config

How to set the machine key to be the same for 2 web applications?

I have 2 web applications where I have to set the machine key to be the same in the web.config. Where do I get the machine key from? ...

Assemblies, Web.config and App.Config -- Building failover logic

How do I engineer failover logic properly if an Assembly (.dll) cannot find a web.config file? Background: I've got our website code nicely modularized into two different .dlls. For simplicity's sake, let's call them: website.dll commonengine.dll The website code and .aspx / .ascx files calls upon the commonengine library for all ...

forms authentication with web.config. Always works on dev, never works on live!

Here is the web.config; <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <customErrors mode="Off"> </customErrors> <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999"> <credentials passwordFormat="MD5"> <user name="admin" p...

Setting up 301 redirects with Dynamic URLs

I'm guessing this is actually an impossible task, but I thought I'd run it by StackOverflow to see if I'm wrong. Basically we have some dynamically created URLs for SEO purposes (around 300,000+ of them) and we want to do 301 redirects to them. Our current URLs look like this: http://www.site.com/&lt;Brand&gt;/&lt;Product Name>/<pr...

Authentification-None for one folder(page) when the project is under FormsAuthentifications

I have a WebApplication on asp.net 2.0 with namespace Admin. I have Form Authentification mode for the project. <authentication mode="Forms"> <forms name="ASP_XML_Form" loginUrl="Login.aspx" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true" cookieless="AutoDetect...

About Security of machinekey

We have a scenario using asp.net Forms Authentication in a web farm and need to setup identical <machinekey /> sections on each servers .config file. Is it better to store the <machinekey /> section in machine.config rather then web.config? what's the advantages and disadvantages of each approach concerning security? <machineKey valida...

How to OpenWebConfiguration with physical path?

hi, I have a win form that creates a site in IIS7. One function needs to open the web.config file and make a few updates. (connection string, smtp, impersonation) However I do not have the virtual path, just the physical path. Is there any way I can still use WebConfigurationManager? I need to use it's ability to find section and read...

When is Session_End() called in ASP.NET MVC ?

I have configured my Web.Config file as follow in a ASP.NET MVC 2 project: <sessionState mode="InProc" timeout="1"/> And added the following in Global.asax.cs: protected void Session_End(object sender, EventArgs e) { System.Diagnostics.Debug.WriteLine("Session_End"); } protected void Session_Start(object sender, EventArgs e)...

ASP.NET web service instances?

Hi, I have a basic web service running that accesses a database and returns XmlDocuments. The database access is defined in a web.config key. I have multiple types of clients accessing these web services, and if lets say, a client of category 1 accesses the Web service, the WS needs to connect to Database1. ClientCategory2 -> Database ...

Setting tracemode="protocolonly" attribute in <source> element in Web.config (.Net 3.5) not working

I am using Network Tracing in my ASP.Net 3.5 application. I see the tracing output in the Output window in Visual Studio 2008 when I run my web site, so I've got the basics working. I'm trying to set tracemode="protocolonly" so I see text and not hex codes for the network data displayed by the trace. The section in my Web.config would...

Do you take a disk "hit" every time you retrieve a web.config value?

I have the following line of code called very often: var configValue = System.Configuration.ConfigurationManager.AppSettings["ConfigValueKey"]; Do I take a disk hit for ASP.Net to retrieve the item from the web.config, or is it smart enough to cache the value in memory and only refresh the cache when the web.config changes? ...

Testing: I *want* to test web.config

I want to do some unit testing on one of my projects. This is a web project, and there will only be one copy of this program running aside from development copies. I want to write some unit tests that will use the web.config. I understand that ordinarily, a tester would stub out this external dependency because he wants to test the co...

GMail + C# + Web.Config: Send Mail Works Programmatically, Throws Exception Using Web.Config Values

Given the following section in Web.Config: <system.net> <mailSettings> <smtp deliveryMethod="Network" from="SomeWebsite Admin &lt;[email protected]&gt;"> <network host="smtp.gmail.com" port="587" defaultCredentials="true" userName="[email protected]" password="somepassword" /> </smtp> </mailSettings...

Is it possible to change an ASP.NET Web.Config value at runtime without reloading the application domain?

Hi all, Is it possible to change a database connection string value in the Web.Config at runtime without reloading the application domain? The reason for doing this is that: I am building a multi-tenanted application which uses the one code instance and multiple databases instances approach, so the database connection string in the we...

Session being reset when using sub-domain.

Hi, I'm trying to use sub-domains in my ASP.NET website but I'm coming across a few problems with the session being reset. I've edited my hosts file to have 'localhost', 'one.localhost' and 'two.localhost'. I can go to any of these URLs and do what I need to do and login to my system. The session mode is defined as follows in the web.c...

How to upload web.config file using WebDAV on IIS7?

I want to copy an ASP.NET MVC website to a remote IIS 7 server using WebDAV. I have created a site in IIS, enabled WebDAV and assigned a special application pool I have named "WebDAV Application Pool". Using a Windows 7 or Vista client I'm able to mount the remote site as a network drive. So far, so good. However, I have problems upload...

How do I resolve the config error which states a machine to application error

I imported a website made in visual studio express 2008 to visual studio express 2010. When I run the home page I get the following error: "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an applicatio...

How to use web.config authentication to build an administrator-only page when UAC is enabled?

I'm building a page that should only be visible to administrators on the web server. The standard prescription for this is: <system.web> <identity impersonate="true" /> <authorization> <allow roles="BUILTIN\Administrators" /> <deny users="*" /> </authorization> </system.web> but when User Access Control (UAC) is enabled...

Root web.config used instead of site web.config

I had a situation on a dev server where all the ASP.Net applications we have started to fail at the same time. After some investigation we found that calls the app settings, in 1.1 apps, and the connection strings collection in 2.0 apps all failed. The config files had the values, but the code was returning null. After some head scratc...

(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) ERROR

I'M getting crazied for that ERROR A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - ...