1
        var url = string.Format("{0}?userid={1}&password ={2}", rootUrl, Id,password);

        //use ClientScript to open a new windows from server side
        var sb = new StringBuilder();
        sb.Append("<script type = 'text/javascript'>");
        sb.Append("window.open('");
        sb.Append(url);
        sb.Append("');");
        sb.Append("</script>");
        ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString());

URLにユーザーIDとパスワードを表示したくありません。

4

2 に答える 2

5

投稿されたコンテンツはそのメソッドでは表示されず、HTTP メッセージ本文に埋め込まれ、クエリ文字列パラメーターとして公開されるため、 HTTP POST 要求を使用して行う必要があります。

そして、@YuriGalanter がコメントしたように、SSL (HTTPS) を使用してネットワーク トラフィックを介してメッセージを暗号化し、スニファーが機密情報を確認できないようにします。

例えば:

HttpWebRequest httpWReq =
    (HttpWebRequest)WebRequest.Create("http://domain.com/page.aspx");

ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "username=user";
postData += "&password=pass";
byte[] data = encoding.GetBytes(postData);

httpWReq.Method = "POST";
httpWReq.ContentType = "application/x-www-form-urlencoded";
httpWReq.ContentLength = data.Length;

using (Stream stream = httpWReq.GetRequestStream())
{
    stream.Write(data,0,data.Length);
}

HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();

string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

そして応答を得るには:

HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
于 2013-09-26T18:24:18.930 に答える
0

ユーザー情報を非表示にする最善の方法は、別のサイトに渡すときにクエリ文字列を暗号化し、現在のブラウザーの新しいタブでその URL を開くことです。

于 2013-09-28T18:14:55.560 に答える