I obtain a HTTPCookie, but need a Net.Cookie. Are they just something you can recast, or how would i go about it?
HttpCookie(String, String) Creates, names, and assigns a value to a new cookie.
The request cookie is what is send from the client to the server (thus what the browser provides). The response cookie are the cookies that you want to place in the browser. The next connection from the browser that accepted the cookie from the response object will provide the cookie in the request object.
A cookie is a small bit of text that accompanies requests and responses as they go between the Web server and client. The cookie contains information that the Web application can read whenever the user visits the site. The browser manages the cookies on client computers.
Actually you have two questions:
Part 1)
This question is really interesting ,I'm still thinking why there are two classes which looks pretty same ,My initial thought was System.Web.HttpCookie inherits System.Net.Cookie
but this isn't true both directly inherit from Object so they are distinct classes ,but the properties matches a lot ,so this gives a hope for the solution of part 2.
Part 2)
I think its possible to convert one into another theoretically since both are just objects if you populate them the right way it will work , here a little analysis when I compared the two classes.
Click to open in new tab to enlarge
Update: The System.Web is made to be used in server-based apps and System.Net can be used for client based apps.
Some Thoughts:
Port
number.Good luck ,let me know how you came up with the final solution ,post the code or link.
Some Links this post has some related code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With