簡體   English   中英

wp8中的身份驗證

[英]Authentication in wp8

我正在開發WP8應用程序。 我需要使用電子郵件ID和密碼在URL中添加數據。 我正在使用webclient() ,但是我不知道該怎么做。 誰能幫助我完成任務? 提前致謝。

我的網址格式:

http://xx.xx.xxx.xxx/main/content/api/data/pagename?email=abcd@abcd.com&sig=abcd

這是我的網址結構。 我需要為上面的用戶添加數據。 我的表格設計:

![enter image description here][1]

當我單擊“登錄”按鈕時,應從上述URL結構中驗證電子郵件ID和密碼。

下面的代碼可用於發布數據,但是我需要知道如何使用電子郵件和密碼來發布數據。

public T Post<T>(string servicePath, string result) 
{ 
    string serviceURL = REST_URI + servicePath; 
    Uri URI = new Uri(serviceURL); 
    System.Net.WebClient webClient = new WebClient(); 
    webClient.Headers["ContentType"] = "application/json"; 
    webClient.Headers["Accept"] = "application/json"; 
    webClient.UploadStringCompleted += this.sendPostCompleted; 
    webClient.UploadStringAsync(URI, HTTP_POST, result); 
    return default(T); 
}

試試這個,這里我正在從文本框中檢索用戶名和密碼,

                var username = uname.Text;
                var password = pass.Password;

                var postData = "email=" + username + "&password=" + password;
                WebClient webClient = new WebClient();
                webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
                var uri = new Uri("Your URL here", UriKind.Absolute);
                webClient.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString();
                webClient.AllowWriteStreamBuffering = true;
                webClient.Encoding = System.Text.Encoding.UTF8;
                webClient.UploadStringAsync(uri, "POST", postData);
                webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(postComplete);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM