System.Net.CookieContainer.SetCookies C# (CSharp) Method

SetCookies() public method

public SetCookies ( Uri uri, string cookieHeader ) : void
uri Uri
cookieHeader string
return void
        public void SetCookies(Uri uri, string cookieHeader) {
            if (uri == null) {
                throw new ArgumentNullException("uri");
            }
            if(cookieHeader == null) {
                throw new ArgumentNullException("cookieHeader");
            }
            CookieCutter(uri, null, cookieHeader, true); //will throw on error
        }

Usage Example

示例#1
0
 public override string this[string name]
 {
     get
     {
         return this.innerCollection[name];
     }
     set
     {
         if ((name != "Content-Length") && (name != "Accept-Charset"))
         {
             if (name == "Cookie")
             {
                 if (this.request != null)
                 {
                     CookieContainer container = new CookieContainer();
                     container.SetCookies(this.request.RequestUri, value);
                     this.request.CookieContainer = container;
                 }
                 else
                 {
                     this.innerCollection[name] = value;
                 }
             }
             else
             {
                 this.innerCollection[name] = value;
             }
         }
     }
 }
All Usage Examples Of System.Net.CookieContainer::SetCookies