http://ourstrade.blog.163.com/blog/static/123663391201072411444580/
解决方案 »
- 关于获取ID的问题
- asp.net如何做K线图
- 求助:多个值和一个值存入数据库表格中
- GridView 表头如何换行?
- webconfig得简单问题
- 当两个关联数据表有名称冲突的字段时怎么办?
- vs.net出现了小小的问题
- 我使用水晶报表,运行时,怎么提示这个错
- 我在电脑上装了oracle的前台服务器,并将远端数据库连接到odbc,现在,data sourse name:yz, service name:zxj ,userid:post .我怎么在asp.n
- 关于页面作为对象,嵌套到另外一个页面后,如何访问问题。
- asp.net 如何根据列名相同统计datatTable中有多少条相同的数据
- 新手,为什么同时支持SQL和AC数据库,要写两个类?用system.data.common不行吗?
[WebMethod(Description = "检测是否正确登录", EnableSession = true)]
public bool CheckLogin(string strUserName, string strPassword)
{
if (strUserName.Equals("admin") && strPassword.Equals("123456"))
{
Session["LoginState"] = true;
}
else
{
Session["LoginState"] = false;
}
return (bool)Session["LoginState"];
}
//调用时候,现在数据库验证一下用户、和密码是否正确[WebMethod(Description = "测试连接", EnableSession = true)]
public string _GetValue(string strInputValue)
{
if (Session["LoginState"] == null || Session["LoginState"].Equals(false))
{
return "无效的身份验证,请重试!";
}
else
{
string strReturnValue = strInputValue + "@CopyRight By BanLao 2010";
return strReturnValue;
}
} 调用该服务,
WebLogon.Service This_Service = new WebLogon.Service();
This_Service.CookieContainer = new System.Net.CookieContainer();
if (This_Service.CheckLogin("admin", "123456"))
{
Response.Write(This_Service._GetValue("This is BanLao's Test Application For Session. "));
}