Sunday 15 February 2015

cookies - How do you use an Ampersand in an HTTPCookie in VB.NET? -


itemprop = "text">

I have saved a cookie user as follows ...

  The look of a slow searchCookie In HttpCookie = New HttpCookie ("SearchCriteria") searchCookie.Item ("SearchText") = FullSearchCriteria.SearchText searchCookie.Item ("search-") = FullSearchCriteria.SearchType  

SearchText Store is a value They have input in the previous page. If there is an ampersand in the cookie we have seen (for example, in Newcastle & Wear), the cookie does not save the following values ​​(search-)

What happens is the cookie is produced like this Is:

SearchText = Tyne & amp;

Obviously the applesand is confusing the cookie. Is there a way to stop getting there?

You can use the method.

Like: HttpCookie = New HttpCookie ("SearchCriteria") searchCookie.Item ("SearchText") = Server.UrlEncode as

  Import HttpContext.Current ... Dim searchCookie (FullSearchCriteria.SearchText) searchCookie.Item ("search-") = Server.UrlEncode (FullSearchCriteria.SearchType)  

This is required as with characters such as this.


No comments:

Post a Comment