开发者

Cookie parameter value problem

开发者 https://www.devze.com 2022-12-25 04:29 出处:网络
I want to use cookie in my project. But now i m using session. And i have some session parameters in .aspx pages.. for example:

I want to use cookie in my project. But now i m using session. And i have some session parameters in .aspx pages.. for example:

 <SelectParameters>
    <asp:SessionParameter Name="refKlinik_id" SessionField="refKlinik_id" />
 </SelectParameters>

Now i want to use Cookie Paramter like that:

  <SelectParameters>
    <asp:CookieParameter Name="refKlinik_id" CookieName="refKlinik_id"
 </SelectParameters>

but cookie's value is like that: sauidpU655614411262762102024i1600369917542431520431414503529630051999*CoreID683251601618012627621046&c

but i need an integer value like 24.

开发者_StackOverflow社区

How can i convert cookie's value to int32

Thanks for your helps


I believe that it the correct way to assign a Cookie to a DataSource Parameter, so there must be something wrong with your code to store the cookie in the first place.

To store the Cookie you should be doing something like this:

HttpCookie myCookie1 = new HttpCookie("refKlinik_id");
myCookie1.Value = Convert.ToInt32(valueToBeAdded);
Response.Cookies.Add(myCookie1);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号