Aborting a Request?

J

Jeffrey A. Voigt

Is there any way (when there is a post back or whatever) to abort it so that
the client (IE) just stops waiting on the request? Basically, I want to
check some values in a database each time a postback happens, but if some
values have not changed.. I don't want it to appear to the user that a
refresh has happened.

I know I could solve this (perhaps) by setting the SmartNav to true, but I
can't rely on my users having the latest IE browser.

Please let me know if this can be done, or if the question is not understood
:)

Thanks,
- jv
 
M

Martin Dechev

Hi, Jeffrey A. Voigt,

I can't tell you if it is good solution, but I just tested it and it seems
to do partly what you need. When there is no new content you can set the
StatusCode of the Response to 204 (No Content) and call Response.End().
Still there will be a post to the server, but the browser (IE6 in my case)
remains on the same page (with no changes to the content) and it receives
only the headers:

HTTP/1.1 204 No Content
....

The code (in C#) should be something like:

if(ThereAreSomeChanges())
{
// display the changes
}
else
{
Response.StatusCode = 204;
Response.End();
}

Greetings
Martin
 
J

Jeffrey A. Voigt

Beautiful!
Thanks!

Martin Dechev said:
Hi, Jeffrey A. Voigt,

I can't tell you if it is good solution, but I just tested it and it seems
to do partly what you need. When there is no new content you can set the
StatusCode of the Response to 204 (No Content) and call Response.End().
Still there will be a post to the server, but the browser (IE6 in my case)
remains on the same page (with no changes to the content) and it receives
only the headers:

HTTP/1.1 204 No Content
...

The code (in C#) should be something like:

if(ThereAreSomeChanges())
{
// display the changes
}
else
{
Response.StatusCode = 204;
Response.End();
}

Greetings
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top