Set Cookie for UIWebView requests

前端 未结 5 1786
抹茶落季
抹茶落季 2021-01-05 18:54

I want to embed an UIWebView into my MonoTouch application for an area that is not yet implemented natively.

In order to authenticate with the website I

5条回答
  •  庸人自扰
    2021-01-05 19:20

    Following Anuj's bug report I felt bad about how many lines of code were required to create the cookies. So the next MonoTouch versions will have new constructors for NSHttpCookie, similar to System.Net.Cookie that will allow you do to something like:

    // this ctor requires all mandatory parameters 
    // so you don't have to guess them while coding
    var cookie = new NSHttpCookie ("iherd", "ulikecookies", "/", "yodawg.com");
    

    You'll even be able to create a NSHttpCookie from a .NET System.Net.Cookie.

    Note: Never hesitate to fill a bug report when an API proves to be way more complicated than it should be :-)

提交回复
热议问题