1

In my application, other pages are running correctly, but this page is throwing an error.

Code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OutReport.aspx.cs" Inherits="HMS.OutReport" MasterPageFile="~/Site.Master" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
</asp:Content>

Error

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 'HMS.OutReport'.

Source Error: 


Line 1:  
Line 2:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OutReport.aspx.cs"     Inherits="HMS.OutReport" MasterPageFile="./Site.Master" %>
Line 3:  <asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
Line 4:  </asp:Content>

Source File: /OutReport.aspx    Line: 2 
Prashant Kumar
  • 20,069
  • 14
  • 47
  • 63
Saranya
  • 1,131
  • 6
  • 16
  • 28

5 Answers5

8

Try changing CodeBehind="OutReport.aspx.cs" to CodeFile="OutReport.aspx.cs"

EDIT:

A CodeBehind Needs to be compiled ( asp.net 1.1 model) and compiled binary is placed in the bin folder of the website. You need to do a compile in visual studio before you deploy. Good model when you do not want the source code to be viewable as plain text ... for example when delivering to a customer who you not have obligation to provide code.

A CodeFile file is located and compiled by ASP.NET at runtime, on demand. You can "pre-compile" your web site to fall back on the older model, which is useful if you won't want to deploy your source code to every web site. But by default, your CodeFile file is a .cs file that is deployed to the site, and the class is generated in the ASP.NET temporary storage folder.

In your code you are telling ASP.NET to ignore the presence of the C# file, and only look for it in the compiled assembly. ASP.NET is, in turn, telling you that the compiled assembly doesn't actually contain the class you told it to look for.

Microsoft DN
  • 9,706
  • 10
  • 51
  • 71
  • yah its working... but wats wrong with my code... i use codebehind only for all those pages... why this page only not taking that... – Saranya Aug 02 '13 at 13:30
0

Check in you codebehind file (OutReport.aspx.cs) if the namespace match HMS.OutReport

namespace HMS
{
   public class OutReport

....

Conrad Lotz
  • 8,200
  • 3
  • 23
  • 27
0

Check the disk space, I gave a similiar error but it was for that very reason.

-1

It is not able to resolve reference to "HMS.OutReport", import reference to the namespace containing OutReport class.

Vasanth
  • 1,670
  • 1
  • 13
  • 17
-1

A detailed post about the possible reasons of this error, with solutions.

And see also

I had this error when the .NET version was wrong - make sure the site is configured to the one you need.

See aspnet_regiis.exe for details.

I think this link will solve your issue

Ajay
  • 6,418
  • 18
  • 79
  • 130