Saturday, March 31, 2012

web.config error when loaded to website!

Hi,

I'm a newbie to ASP.net. I have created a simple ASP.NET program when I run it on VWD 2005 Express Edition, it runs fine. But when I loaded to my website, it gives me an errors see below:

Error:

Server Error in '/' Application.

Runtime Error

Description:An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="Off"/> </system.web></configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web></configuration>

//My Web.config file

<?

xmlversion="1.0"?>

<!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<

configuration>

<

appSettings/>

<

connectionStrings/>

<

system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<

compilationdebug="false"/>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<

authenticationmode="Windows"/>

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

-->

<

customErrorsmode="Off"defaultRedirect="GenericErrorPage.htm">

<

errorstatusCode="403"redirect="NoAccess.htm" />

<

errorstatusCode="404"redirect="FileNotFound.htm" />

</

customErrors>

</

system.web>

</

configuration>

//My Default.aspx

<%

@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><div><asp:TextBoxID="TB1"runat="server"Height="142px"Width="255px"></asp:TextBox></div></form>

</

body>

</

html>

//My Default.aspx.cs

using

System;

using

System.Data;

using

System.Configuration;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

TB1.Text =

"hello world";

}

}

What am I doing wrong, please help!!

Thanks in advance

Jason

Hi,

I noticed that you didn't use a capitol 'H' in 'hello world.' Seriously, I'm not sure what is going wrong, but there's at least one thing that caught my eye in your web.config - you are using 'windows authentication.' That's fine for an intr-a-net site, where the users will have already logged on using their domain's windows authentication, but you can't expect that Joe Surfer on the internet will have the proper creds (and without authentication, you are in the same boat as Joe)..

I was looking for a reference to something (like an image file), that would be located on your localhost, that you forgot to change (common mistake), but your app is so simple, I didn't notice anything other than the 'windows authentication' See if changing that clears things up for you. Good luck, BRN..


Is the web server set up as an application do you know in IIS?

Do you have the correct version of asp on there?


When an asp.net 2.0 application is placed in a virtual folder that is configured as an asp.net 1.1 app, the 1.1 framework will be unable to process the web.config file and the application will not run. Make sure the folder you loaded you app to is configured as anasp.net 2.0 app.

check this:
http://www.extremeexperts.com/Net/Articles/ConfigurationManagementinASPNETPart2.aspx


Hi,

Thanks all for the reply, I didn't run my application on localhost. All I did was, I tested my application in VWD 2005 express and it works fine there, then I loaded it up to my website which hosted by "Startlogic", I got the "Window Logic" package which they said is capable of handle ASP.NET 2.0. But when I enter in the direct URL to my App then I got the error above from the web.config file. I'm really new to ASP.NET but really interested to learn. If you guys can help me out, very much appreciated.

Thanks

Jason


Like another poster stated, try taking out Windows Authentication. Also make sure your hosting company is running the .NET 2.0 framework, if they don't it will not run.

As others have said, it sounds like a config problem with your site. You need to get your hosts to check that your web root is setup as an application and that it is setup for asp.net 2.0.


Hi,

Thank guys for all your help. I found the problem from your suggestions, it was my web hosting that only support 1.0 and not 2.0. I have to email them and ask them if they have a way for me to work around this. Again, thanks for all your help

Jason

0 comments:

Post a Comment