解决方案 »
- 分享面试题与求解答案
- SqlHelper.dll 哪位大大有,能连同使用方法一起发给我吗,谢谢
- 100分求救:asp.net下mysql数据库的sql语句返回主键怎么写
- 外面获取gridview控件里面的模版控件
- 传值问题
- 请教用DATALIST做留言版问题
- 哪有 全国省市地区名称 数据库 精确到县的
- 在URL指定调用JS的方法问题,100分,先到先得
- 配置文件machine.config提示错误requiresPhoneNumbersAsPlainText = "false"
- 在XP中怎样配置IIS才能调试aspx文件,有这样的文章吗?
- 继续纠结 上传控件的问题,看了很多帖子,试过很多方法,就是搞不定
- 谁帮我把这试卷给做一下呢 每人做一题啊 不要做多
{ [WebMethod]
[System.Web.Services.Protocols.SoapHeader("header")]
public string helloword()
{
if (soap()) //判断穿过来的密码是否正确
{
return "helloword";
}
return "接口调用出错";
} /// <summary>
/// soap头身份验证
/// </summary>
/// <returns></returns>
public bool soap()
{
if (header == null)
{
return false;
}
if (header.ValideUser(header.keycode))
{
return true;
}
else
{
return false;
}
}}public class MySoapHeader : SoapHeader
{
private string password = "123456";
public MySoapHeader()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public string keycode;
public bool ValideUser(string key)
{
if (key == password)
{
return true;
}
else
{
return false;
}
}
}
若若都问下 你设置了所谓的账号密码..那么 软件本身post的时候 我依然可以抓包(header)看到所谓的值吧...既然看到值了 不管明文与否..我都可以模拟..所以你这技能还是不能实现...
protected void Button1_Click(object sender, EventArgs e)//获取Web.config中配置的数据库连接字符串
{
string sqlstr = System.Configuration.ConfigurationManager.AppSettings["con"].ToString();
SqlConnection conn = new SqlConnection(sqlstr);//连接数据库
conn.Open(); //打开数据库
SqlCommand cmd = new SqlCommand(); //创建SqlCommand对象
cmd.Connection = conn; //设置该对象使用conn连接数据库
cmd.CommandType = CommandType.Text; //设置类型
cmd.CommandText = "select count(*) from Tb_Login where UseName='" + txtUserName.Text.Trim() + "' and UsePassword='"+txtPwd.Text.Trim()+"'";
//设置sql语句
int flag = int.Parse(cmd.ExecuteScalar().ToString());//执行sql语句并获取返回值
if (flag > 0) //如果大于0
{
Page.ClientScript.RegisterStartupScript(this.Parent.GetType(), "", "alert('登录成功');", true);//说明登陆成功
}
else
{
Page.ClientScript.RegisterStartupScript(this.Parent.GetType(), "", "alert('登录失败');", true);//否则登陆失败
}
conn.Close();//关闭连接
}