public string pd_price_show()
{
string result=null;
//HttpCookie cookie=Request.Cookies["mycookie"];
if(Request.Cookies["mycookie"]!=null)
{
HttpCookie cookie=Request.Cookies["mycookie"];
if(cookie.Values["userflag"].ToString()=="1")
{
result="1";
}
else
{
if(cookie.Values["userflag"].ToString()=="3")
{
result="3";
}
}
}
else
{
result="2";
}
return result;
}
-------------------------------------------------------
代码如上,我放到页面代码里就不会出错
一放到类里供外部调用就会提示"请求在此上下文中不可用 "的错误
哪位出来指点一下,谢谢..
{
string result=null;
//HttpCookie cookie=Request.Cookies["mycookie"];
if(Request.Cookies["mycookie"]!=null)
{
HttpCookie cookie=Request.Cookies["mycookie"];
if(cookie.Values["userflag"].ToString()=="1")
{
result="1";
}
else
{
if(cookie.Values["userflag"].ToString()=="3")
{
result="3";
}
}
}
else
{
result="2";
}
return result;
}
-------------------------------------------------------
代码如上,我放到页面代码里就不会出错
一放到类里供外部调用就会提示"请求在此上下文中不可用 "的错误
哪位出来指点一下,谢谢..
还在犹豫什么,互通数据是你最好的选择。
详情请访问:http://www.515dns.com
QQ:287895593
你单独拎出来就访问不到该property了
public string pd_price_show(Page page)
{
string result = null;
//HttpCookie cookie=Request.Cookies["mycookie"];
if (page.Request.Cookies["mycookie"] != null)
{
HttpCookie cookie = page.Request.Cookies["mycookie"];
if (cookie.Values["userflag"].ToString() == "1")
{
result = "1";
}
else
{
if (cookie.Values["userflag"].ToString() == "3")
{
result = "3";
}
}
}
else
{
result = "2";
}
return result;
}
页面调用:
new Class1().pd_price_show(this);
System.Web
然后添加命名空间:
System.Web.UI.Page
继承ui.page过来就行了
按cppfaq 说的方法就OK了
谢谢
结贴..