잊지 않겠습니다.

Posted by Y2K
,

Digest Auth

            CredentialCache webservCredentials = new CredentialCache();
            webservCredentials.Add(new Uri("http://123.123.123.123:8888/MobileAccessVersion.asmx"), "Digest", new NetworkCredential("ykyoon", "*****", "***"));
            webService.Credentials = webservCredentials;

Basic Auth

            CredentialCache webservCredentials = new CredentialCache();
            webservCredentials.Add(new Uri("http://123.123.123.123:8888/MobileAccessVersion.asmx"), "Basic", new NetworkCredential("ykyoon", "*****", "***"));
            webService.Credentials = webservCredentials;

 

상당히 편하게 구현이 가능한 방법

일부러 MD5로 압축하거나, Base64로 따로 인코딩을 할 필요도 없이 아주 산뜻하게 끝이 난다. ^^

Posted by Y2K
,

A cookie is stored on the client's machine by their web browser software. To set a cookie, we include information in an HttpResponse that instructs the browser to save a cookie on the client's system. Here's the basic code for writing a Cookie in ASP.NET 

Using System.Web;



Response.Cookies["BackgroundColor"].Value = "Red";




And to read the cookie back : 

Response.Write

(Request.Cookies["BackgroundColor"].Value);




Note that for security reasons you can only read a cookie that was set within the same domain name. 

Sometimes you may need a collection of stored items, such as user address details. In this case you could read in a cookie collection like this: 

HttpCookieCollection cookies = Request.Cookies;

for(int n=0;n<cookies.Count;n++)

{

    HttpCookie cookie = cookies[n];

    Response.Write("<hr/>Name: <b>" + cookie.Name + "</b><br />");

    Response.Write("Expiry: " + cookie.Expires + "<br />");

    Response.Write("Address1: " + cookie.Address1+ "<br />");

    Response.Write("Address2: " + cookie.Address2+ "<br />");

    Response.Write("City: " + cookie.City+ "<br />");

    Response.Write("Zip: " + cookie.Zip+ "<br />");

}


Posted by Y2K
,