Web Config Not Working!

So the scenario is: I’m taking an existing HTML/CSS website and adding a contact form using ASP.NET right. All goes well until I put it up on my server and I get this “custom errors” error in my web config file. My web config file doesn’t contain much of anything so I try to add the code in the error message (both of them) with no luck. What can I do to fix this problem and avoid it in the future?

http://ns-llc.com/alexnodr/networkspecialists/contactUs.aspx

So, what happens when you follow the directions in the “Details:” section?

Nothing changes :frowning:
> Gives me the same error message either way.

What is the folder layout? What version of ASP.NET is the server configured for?

turn web.config custom errors to off, try adding the xml code if its not there.

Try also finding out what version of .net your hosting supports. Alot of them only support 2.0.

Well i tried adding the code on the error page to my web config file and that didn’t help so turning custom errors off doesn’t seem to be an option at this point.

I talked to the people hosting the server and they say they have the latest version of ASP.NET running.

Ok, what tool did you use to make the contact form.

Well I’m using Visual Studio Web Dev 2010. I also found out that the servers .net framework is 2.0 - does it really make that much of a difference though?

You may be compiling for .NET 4.0 but if your server is running 2.0 then I think you’re going to have some problems. Did you reconcile why your host says they’re running the latest version if it is 2.0?

You should be able turn turn “off” custom errors and turn “on” debug through your web.config. That will give you a better idea of the problem you’re facing.

Well I tried that - and nothing has changed - my web.config file looks like this:

<?xml version=“1.0”?>

<configuration>

&lt;system.web&gt;
    &lt;compilation debug="true" targetFramework="2.0" /&gt;
&lt;/system.web&gt;
&lt;system.web&gt;
  &lt;customErrors mode="Off"&gt;
&lt;/customErrors&gt;

</system.web>

</configuration>

Try this:

<?xml version=“1.0”?>

<configuration>

<system.web>
<compilation debug=“true” targetFramework=“2.0” />
<customErrors mode=“Off”></customErrors>
</system.web>

</configuration>

It doesn’t seem to recognize the targetFramework=“2.0” it keeps erroring out on me and a blue line is under it. Not sure what it means.

Make sure which version of .NET the host has setup your site to use

Is your web.config in the root directory of your application?

Have you tried just writing the value to the screen as opposed to actually trying to use it? (e.g. Response.Write(ConfigurationSettings.AppSettings(“[keyname]”))

I store all of my database connection strings in the web.config file and do something like this:

web.config:
<appSettings>
<add key=“Clients” value=“workstation id=PC;user ID=Username;password=Password;data source=Server;persist security info=True;initial catalog=Database”/>
</appSettings>

In code:

sqlConn = New SqlConnection
sqlConn.ConnectionString = ConfigurationSettings.AppSettings(“Clients”)

And this works fine.

–Stole this from a moderator

I will only tell you how to do it, not do it for you.

Unless, of course, you want to hire me to do work for you.

Well I’m not using any kind of kind of database connections. And my server is running 2.0 - which is ridiculously hard to develop for I’ve come to realize. . .