Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7880557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:10:26+00:00 2026-06-03T04:10:26+00:00

My UIWebview is not saving cookies at all. It is stuck in cookieless mode

  • 0

My UIWebview is not saving cookies at all. It is stuck in cookieless mode and as a result, the webpage is putting the cookie information in the url instead.

Here is what I am doing. I have a singleton for my UIWebview and 4 UITabBar buttons on the bottom. Each tabbar button takes the user to a different page on the site. Now, when the user is navigating the site through the webview itself, everything is fine and session persists. But the second a user clicks on a tabbar button, the session gets reset.

I even set NSHttpCookieStorage to always accept cookies. Still no go.

Here is the code for my singleton for UIWebview and NSMutableUrlRequest

    public static UIWebView instance;
    public static NSMutableUrlRequest urlRequest;
    public static NSUrlConnection connection;
    public static NSHttpCookieStorage cookie;
    static bool TokenSent = false;
    public UIWebViewSingleton () {}

    public static UIWebView Instance
    {
        get
        {
            if (instance == null)
            {   
                Debugger.Debug ("new uiwebview created");
                cookie = NSHttpCookieStorage.SharedStorage;
                cookie.AcceptPolicy = NSHttpCookieAcceptPolicy.Always;
                connection = new NSUrlConnection(); 
                instance = new UIWebView(new RectangleF(0f, 0f, 320f, 416f));
                instance.ScalesPageToFit = true;
                instance.LoadStarted += delegate {
                    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
                };
                instance.LoadFinished += delegate {
                    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
                    AcquireUserId();
                };
                instance.MultipleTouchEnabled = false;
            }
            return instance;
        }
    }

    public static NSMutableUrlRequest UrlRequest
    {
        get
        {
            if (urlRequest == null)
            {
                urlRequest = new NSMutableUrlRequest();
            }
            return urlRequest;
        }
    }

This is how I change to a page based on which button was pressed. The back button is working fine.

        case BTN_BACK:
            btn_ret.TouchUpInside += delegate(object sender, EventArgs e) {
                UIWebViewSingleton.Instance.GoBack();       
            };
            break;

        case BTN_GUIDE:
            btn_ret.TouchUpInside += delegate(object sender, EventArgs e) {
                UIWebViewSingleton.UrlRequest.Url = new NSUrl(StaticFileNames.GuideUrl);
                UIWebViewSingleton.Instance.LoadRequest (UIWebViewSingleton.UrlRequest);        
            };
            break;

        case BTN_HOME:
            btn_ret.TouchUpInside += delegate(object sender, EventArgs e) {
                UIWebViewSingleton.UrlRequest.Url = new NSUrl(StaticFileNames.BaseUrl);
                UIWebViewSingleton.Instance.LoadRequest (UIWebViewSingleton.UrlRequest);        
            };
            break;

Does anyone have any ideas as to why my UIWebView is not accepting cookies? I’m still confused about NSHttpCookieStorage and if I’m using that correctly.

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:10:27+00:00Added an answer on June 3, 2026 at 4:10 am

    I went with this work-around which was sufficient.

    Since the cookie is in the url, I just parse it out and put programmatically put it into the urls that the tabbar buttons point to. Problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

LoadHtmlString UIWebView is not working. I want to play embeded you tube video. I
I'm not talking about a UIWebView , I want to open the mobile safari
I'm trying to do a UIWebView , but not allowing the user to visit
I have problem with UIWebView delay when the load image from url. In my
I Have a UIWebView that displays third party web page (not a page I
When I add an HTML file in UIWebView I am not getting the ful
I want to load .js(javaScript) file in UIWebView not only one function like [webView
As a UIWebView doesnt not inherit from UIScrollView it doesnt have the flashScrollIndicators method.
I've heard varying things about whether or not creating a Subclass of UIWebView is
Yes, I know UIWebView has didFinishedLoad & didStartLoad delegate. However, the didFinishedLoad does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.