views:

84

answers:

4

Hello everyone,

The question that I have is very basic: Is there a way to inform the web browser that the content of the cookie has changed?

I don't want to keep looking at the file and check if it has been updated because it'll cause performance degree on my app.

Thanks in advance!

A: 

It's always the job of the server to "push" the new cookie to the browser (in ASP.NET, by setting Response.Cookies("cookie_name")).

I'm not sure to understand your concern, only your application can know that the user's cookie needs to be changed, but it's usually not stored as a file on the server.

Zorglub
I don't think that you got my point, specially because I didn't explain what is goig on.I got an ASP page running inside a WPF application (that acts like a browser), the ASP app page populates the cookie and the WPF should read that information. I don't want the WPF appl to keep looking a the cookie, but the cookie to inform the WPF that it has been updated.
Felipe Barreiros
A: 

You would probably have to check for the Cookie or Set-Cookie http headers that come with the ASP page whenever it reloads in your application, though this would not account for changes made by javascript.

Rudism
A: 

If the ASP page is refreshing each time a cookie changes, that is likely to be a much larger overhead than the WPF reading the cookie from the disk.

ck
A: 

Well, since the ASP page needs to be active in order to SET the cookies, why couldn't you just use a HttpClient to request the cookies in your WPF app and on the server, set the cookies. Then send HTTP Response depending on whether or not you set the cookies. If you receive a 200 OK response, you can know your cookies are set. If there's an error, send a 500 Server Error back.

Crowe T. Robot