简体   繁体   中英

Cookie parameter value problem

I want to use cookie in my project. But now im 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.

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM