locked
Cookies on IOS (iPad) RRS feed

  • Question

  • User609626699 posted

    Hello, I have a problem with Cookies. I have a MVC web-application. I use .Net 4.5.

    I set cookies as my code below shows. It works fine on desktop computers and Windows Phone 8.

    But, when I try to access from my iPad, it doesn't work. I don't get the cookie value.

    I have tried other suggestions. Adding a browser file as some people suggested and also added a machine configuration key to my web.config.

    What could be the problem?

    Best regards,

    Thorsten

    <!--
        You can find existing browser definitions at
        <windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers
    -->
    <browsers>
        <browser refID="Mozilla">
            <capabilities>
                <capability name="cookies" value="true" />
            </capabilities>
        </browser>
    </browsers>
    

            public static void SetSimpleSearch(SimpleSearch search, HttpResponseBase response, HttpRequestBase request)
            {
                bool newCookie = true;
                HttpCookie myCookie = new HttpCookie("UserSettings");
                if (request.Cookies["UserSettings"] != null/* && response.Cookies["UserSettings"].Values.Count > 0*/)
                {
                    myCookie = request.Cookies["UserSettings"];
                    newCookie = false; 
                }
                myCookie["SimpleSearch.Destination"] = search.Destination;
                myCookie["SimpleSearch.Origin"] = search.Origin;
                myCookie.Expires = DateTime.Now.AddDays(30d);
                if (newCookie)
                {
                    response.Cookies.Add(myCookie);
                }
                else
                {
                    response.Cookies.Set(myCookie);
                }
            }
            public static SimpleSearch GetSimpleSearch(HttpRequestBase request)
            {
                SimpleSearch retValue = new SimpleSearch();
                HttpCookie myCookie = null;
                if (request.Cookies["UserSettings"] != null/* && response.Cookies["UserSettings"].Values.Count > 0*/)
                {
                    myCookie = request.Cookies["UserSettings"];
                    retValue.Destination = myCookie["SimpleSearch.Destination"];
                    retValue.Origin = myCookie["SimpleSearch.Origin"];
                }
                return retValue;
            }
    

    Wednesday, November 5, 2014 6:01 AM

All replies

  • User1508394307 posted

    Are they allowed on your device? http://support.apple.com/de-de/ht1677 

    Thursday, November 6, 2014 6:59 AM
  • User609626699 posted

    Thank you for the answer, yes they are allowed.

    In Chrome - Allow cookies and a blue I.

    And in Safari from the settingspage - Allow always.

    Best regards,

    Thorsten

    Thursday, November 6, 2014 8:17 AM