1
我有一個web應用程序(在VS2008 C#ASP.NET 3.5框架)。在我的登錄頁面有一個函數CheckLogin()執行登錄功能。我使用了遠程web服務。 objWeb是該web服務的對象。 WebService_CheckLogin是我的遠程web服務中的web方法。數據庫連接字符串寫在我的websrvice的類文件中。如何確保Webservice的安全性?
public DataSet CheckLogin()
{
string username = Convert.ToString(txtUname.Text);
string password = Convert.ToString(txtPassword.Text);
return objWEB.WebService_CheckLogin(username,password);
}
WEBMETHOD在我的web
[WebMethod]
public DataSet WebService_CheckLogin(string uname,string pswd)
{
c.connect();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand("sp_verifyuser", c.con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Username", uname);
cmd.Parameters.AddWithValue("@Password", pswd);
c.getdataset(cmd, ref ds);
return ds;
}
在web服務
public void connect()
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.ConnectionString="Data Source=xxxxxxx;Initial Catalog=xx;User ID=xx;Password=xxxx";
con.Open();
}
我的問題我的連接類是 '有什麼不對按照安全'?我的意思是'任何人都可以通過它的url來接受我的web服務'?我有我傳遞的字符串作爲參數就像
string profilePassword = objWEB.Verify_ProilePassword("exec sp_verify_profilepwd '" + txt_profil_pwd.Text + "','"+cid+"'");
問候, 大衛
@格雷格......所以如何應該是我CheckLogin()? –