3
Answers

web.config and code behind files

Ken Barrett

Ken Barrett

15y
6.3k
1
What does the web.config file have to do with using code behind files?  I can't seem to find any info on this on line.

Background:
I have a godaddy account and any .aspx page I use won't run if it uses a code behind file. If I go the asp "classic" route and have everything in one file it runs fine.

Here is my web.config file :

<?xml version="1.0"?>
<configuration>
    <system.web>
      <customErrors mode="Off"/>
    </system.web>
</configuration>


When I run a simple .aspx page that uses a code behind file, this is the error I get:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'test2'.

Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Source File: d:\hosting\barrettken\test2.aspx    Line: 1


Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407



When I asked godaddy support about the issue with code behind files, this is the answer I got.

The ASP code behind module is installed by default so you should not have any issues with using code behind files. We found that if the web.config file is disabled the ASP files load properly. We advise that you troubleshoot your web.config configuration via your preferred search engine and/or web resources to resolve the issue.


So, what is the issue with my web.config file??

TIA
Ken
Answers (3)