namespace Comm_html
{
using System;
using System.Data;
using System.Text;
using System.Web.SessionState; public class Comm_html
{
public String asc_center_cd_text()
{
if (Session["SS_ASC_CD"]!=Session["SS_CENTER"])
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='"+Session["SS_ASC_CD"]+"' readonly>";
}
else
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='' >";
}
}
}}set outdir=E:\backup\050223\www\bin\Comm_html.dll
set assemblies=System.dll,System.data.dll,System.Web.dllcsc /t:library /out:%outdir% /r:%assemblies% Comm_html.cs
pause
报错为:名称“Session” 在类或命名空间“Comm_html。Comm_html”中不存在
{
using System;
using System.Data;
using System.Text;
using System.Web.SessionState; public class Comm_html
{
public String asc_center_cd_text()
{
if (Session["SS_ASC_CD"]!=Session["SS_CENTER"])
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='"+Session["SS_ASC_CD"]+"' readonly>";
}
else
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='' >";
}
}
}}set outdir=E:\backup\050223\www\bin\Comm_html.dll
set assemblies=System.dll,System.data.dll,System.Web.dllcsc /t:library /out:%outdir% /r:%assemblies% Comm_html.cs
pause
报错为:名称“Session” 在类或命名空间“Comm_html。Comm_html”中不存在
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
2、System.Web.HttpContext.Current.Session[""]
比如定义:public void GetSession( System.Web.UI.Page page )
{
page.Session[""];
}
在调用的页面的方法内使用:
GetSession( this );
{
using System;
using System.Data;
using System.Text;
using System.Web.SessionState; public class Comm_html
{
public String asc_center_cd_text(System.Web.SessionState.HttpSessionState Session) /////把Session作为参数
{
if (Session["SS_ASC_CD"]!=Session["SS_CENTER"])
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='"+Session["SS_ASC_CD"]+"' readonly>";
}
else
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='' >";
}
}
}}
namespace Comm_html
{
using System;
using System.Data;
using System.Text;
using System.Web.SessionState; public class Comm_html
{
private System.Web.SessionState.HttpSessionState Session
public Comm_html(System.Web.SessionState.HttpSessionState Session)
{
this.Session = Session;
} public String asc_center_cd_text() {
if (Session["SS_ASC_CD"]!=Session["SS_CENTER"])
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='"+Session["SS_ASC_CD"]+"' readonly>";
}
else
{
return "<input name='ASC_CD' type='text' class='CReadOnly' size='10' value='' >";
}
}
}}