Persist javascript variables between GET requests?

后端 未结 4 500
-上瘾入骨i
-上瘾入骨i 2021-01-22 09:31

ASP .NET is allowed
Storing the values in hidden input fields is allowed
Query String is not allowed
POST request is not allowed

It is possible to store J

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 10:13

    Can I use cookies for this ?

    Yes, see this tutorial on using cookies in Javascript.

    Are there other posibilities?

    If you are not allowed to append anything the URL of your requests, I can't come up with any.

    Where cookies are stored when Request is made ?

    In the HTTP request header. The aforementioned tutorial will tell you how to read their values from Javascript. On the server side with ASP.Net, you can read cookie values using Request.Cookie["cookieName"] which returns an instance of HttpCookie.

提交回复
热议问题