このコードはVisual Studio 2010を搭載したローカルコンピュータで正常に動作し、 は.NET Framework 2.0で正常に動作しましたが、2.0からサーバーをアップグレードしたとき4.0 には、このエラーを与えている:Asp.Netサーバーを2.0から4.0にアップグレードするとエラーが発生する
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'staticpage_namespace' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 10: using System.Web.UI.HtmlControls;
Line 11: using System.Data.SqlClient;
Line 12: using staticpage_namespace;
Line 13:
Line 14:
は、任意の任意のボディを助けることができますか?ここで
は、私はApp_Codeフォルダー内のクラスのために使用していたコードである: -namespace staticpage_namespace
{
public class Staticpage
{
......
public SqlDataReader InsertHome()
{
SqlDataReader dr = SqlHelper.ExecuteReader(configclass.DbConn, CommandType.StoredProcedure, "InsertHome");
return dr;
}
public Staticpage()
{
//
// TODO: Add constructor logic here
//
}
}
}
そして、これは私のWebフォームのコードです: -
using staticpage_namespace;
public partial class _Default1 : System.Web.UI.Page
{
}
Web.Configにを追加しましたか? –
はい、web.configファイルにこの行を含めました – bhanu
app_codeフォルダに追加してみるか、この名前空間への参照を追加してください –