Hi all
When I start a new thread that tries to call:
HttpContext.Current.Response.Redirect()
It fails as Current returns null, is there anyway to access the current
httpcontext from within a new thread?
Thanks
Kev 8 2144
Typically when you spawn another thread, the original request thread will
have completed and no longer be around.
If you are blocking on the request thread until your spawned is completed,
could you just not use a return value from your spawned thread?
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message
news:cu**********@newsfeed.th.ifl.net... Hi all
When I start a new thread that tries to call:
HttpContext.Current.Response.Redirect()
It fails as Current returns null, is there anyway to access the current httpcontext from within a new thread?
Thanks Kev
Hi Bill
What I basically want to do is redirect the user to an aspx, but at the
server side I want it to wait until a response has been posted back from the
client side before continuing execution.
Any ideas?
Thanks
Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:es**************@tk2msftngp13.phx.gbl... Typically when you spawn another thread, the original request thread will have completed and no longer be around.
If you are blocking on the request thread until your spawned is completed, could you just not use a return value from your spawned thread?
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... Hi all
When I start a new thread that tries to call:
HttpContext.Current.Response.Redirect()
It fails as Current returns null, is there anyway to access the current httpcontext from within a new thread?
Thanks Kev
I am not exactly sure what you are wanting to do.
The user makes a request to Page1.aspx.
Page1.aspx starts ThreadA.
ThreadA waits until Page1.aspx has been posted from the same user.
ThreadA starts processing.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message
news:cu**********@newsfeed.th.ifl.net... Hi Bill
What I basically want to do is redirect the user to an aspx, but at the server side I want it to wait until a response has been posted back from
the client side before continuing execution.
Any ideas?
Thanks Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:es**************@tk2msftngp13.phx.gbl... Typically when you spawn another thread, the original request thread
will have completed and no longer be around.
If you are blocking on the request thread until your spawned is
completed, could you just not use a return value from your spawned thread?
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... Hi all
When I start a new thread that tries to call:
HttpContext.Current.Response.Redirect()
It fails as Current returns null, is there anyway to access the current httpcontext from within a new thread?
Thanks Kev
I have a class that redirects the user to a page, but I want the class to
stay "alive" until the page has been posted from the user.
As you know the Response.Redirect stops all execution, the behaviour I want
is for the page to still post but for the execution to continue.
HTH
Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:eW**************@TK2MSFTNGP09.phx.gbl... I am not exactly sure what you are wanting to do.
The user makes a request to Page1.aspx. Page1.aspx starts ThreadA. ThreadA waits until Page1.aspx has been posted from the same user. ThreadA starts processing.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... Hi Bill
What I basically want to do is redirect the user to an aspx, but at the server side I want it to wait until a response has been posted back from the client side before continuing execution.
Any ideas?
Thanks Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:es**************@tk2msftngp13.phx.gbl... > Typically when you spawn another thread, the original request thread will > have completed and no longer be around. > > If you are blocking on the request thread until your spawned is completed, > could you just not use a return value from your spawned thread? > > bill > > "Mantorok" <no**@tiscali.co.uk> wrote in message > news:cu**********@newsfeed.th.ifl.net... >> Hi all >> >> When I start a new thread that tries to call: >> >> HttpContext.Current.Response.Redirect() >> >> It fails as Current returns null, is there anyway to access the >> current >> httpcontext from within a new thread? >> >> Thanks >> Kev >> >> > >
Response.Redirect( newPage, false ) -- Will continue execution and just add
the Redirect header to the outgoing request.
Response.Redirect( newPage, true ) -- Will cause a thread abort exception
and the Redirect header to the outgoing request.
Can you not place your class in Session?
I am still not sure where the spawned thread is coming in.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message
news:cu**********@newsfeed.th.ifl.net... I have a class that redirects the user to a page, but I want the class to stay "alive" until the page has been posted from the user.
As you know the Response.Redirect stops all execution, the behaviour I
want is for the page to still post but for the execution to continue.
HTH Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl...I am not exactly sure what you are wanting to do.
The user makes a request to Page1.aspx. Page1.aspx starts ThreadA. ThreadA waits until Page1.aspx has been posted from the same user. ThreadA starts processing.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... Hi Bill
What I basically want to do is redirect the user to an aspx, but at the server side I want it to wait until a response has been posted back
from the client side before continuing execution.
Any ideas?
Thanks Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:es**************@tk2msftngp13.phx.gbl... > Typically when you spawn another thread, the original request thread will > have completed and no longer be around. > > If you are blocking on the request thread until your spawned is completed, > could you just not use a return value from your spawned thread? > > bill > > "Mantorok" <no**@tiscali.co.uk> wrote in message > news:cu**********@newsfeed.th.ifl.net... >> Hi all >> >> When I start a new thread that tries to call: >> >> HttpContext.Current.Response.Redirect() >> >> It fails as Current returns null, is there anyway to access the >> current >> httpcontext from within a new thread? >> >> Thanks >> Kev >> >> > >
Hi bill
Well, here is a typical example of what I want to do...
public class PageShower
{
public void ShowAndWait()
{
// Redirect then wake up when required
HttpContext.Current.Response.Redirect("wizard.aspx ", false);
// Sleep
Sleep();
}
}
I want the redirect to happen while the class waits, it will then be
subsequently woken up later on. Ignore the other thread for now, I though
threading may be able to provide a solution on this matter.
HTH
Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Response.Redirect( newPage, false ) -- Will continue execution and just add the Redirect header to the outgoing request.
Response.Redirect( newPage, true ) -- Will cause a thread abort exception and the Redirect header to the outgoing request.
Can you not place your class in Session?
I am still not sure where the spawned thread is coming in.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... I have a class that redirects the user to a page, but I want the class to stay "alive" until the page has been posted from the user.
As you know the Response.Redirect stops all execution, the behaviour I want is for the page to still post but for the execution to continue.
HTH Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl... >I am not exactly sure what you are wanting to do. > > The user makes a request to Page1.aspx. > Page1.aspx starts ThreadA. > ThreadA waits until Page1.aspx has been posted from the same user. > ThreadA starts processing. > > bill > > > "Mantorok" <no**@tiscali.co.uk> wrote in message > news:cu**********@newsfeed.th.ifl.net... >> Hi Bill >> >> What I basically want to do is redirect the user to an aspx, but at >> the >> server side I want it to wait until a response has been posted back from > the >> client side before continuing execution. >> >> Any ideas? >> >> Thanks >> Kev >> >> "William F. Robertson, Jr." <th****@nameht.org> wrote in message >> news:es**************@tk2msftngp13.phx.gbl... >> > Typically when you spawn another thread, the original request thread > will >> > have completed and no longer be around. >> > >> > If you are blocking on the request thread until your spawned is > completed, >> > could you just not use a return value from your spawned thread? >> > >> > bill >> > >> > "Mantorok" <no**@tiscali.co.uk> wrote in message >> > news:cu**********@newsfeed.th.ifl.net... >> >> Hi all >> >> >> >> When I start a new thread that tries to call: >> >> >> >> HttpContext.Current.Response.Redirect() >> >> >> >> It fails as Current returns null, is there anyway to access the >> >> current >> >> httpcontext from within a new thread? >> >> >> >> Thanks >> >> Kev >> >> >> >> >> > >> > >> >> > >
I guess I am being hard headed. Or just dumb, but I still don't see what
you are trying to accomplish.
Why don't you take you PageShower class and place it into session. Then
after the page redirects, you can pull the same object out of Session and
call another method.
Remove the Sleep method from the ShowAndWait method.
One of the rules I go with on Threading, it you can't think of a good reason
why you are using threading, then don't. If your only reason is, I thought
"it" would be better, it probably isn't.
HTH,
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message
news:cu**********@newsfeed.th.ifl.net... Hi bill
Well, here is a typical example of what I want to do...
public class PageShower { public void ShowAndWait() { // Redirect then wake up when required HttpContext.Current.Response.Redirect("wizard.aspx ", false);
// Sleep Sleep(); } }
I want the redirect to happen while the class waits, it will then be subsequently woken up later on. Ignore the other thread for now, I though threading may be able to provide a solution on this matter.
HTH Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Response.Redirect( newPage, false ) -- Will continue execution and just add the Redirect header to the outgoing request.
Response.Redirect( newPage, true ) -- Will cause a thread abort
exception and the Redirect header to the outgoing request.
Can you not place your class in Session?
I am still not sure where the spawned thread is coming in.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... I have a class that redirects the user to a page, but I want the class
to stay "alive" until the page has been posted from the user.
As you know the Response.Redirect stops all execution, the behaviour I want is for the page to still post but for the execution to continue.
HTH Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl... >I am not exactly sure what you are wanting to do. > > The user makes a request to Page1.aspx. > Page1.aspx starts ThreadA. > ThreadA waits until Page1.aspx has been posted from the same user. > ThreadA starts processing. > > bill > > > "Mantorok" <no**@tiscali.co.uk> wrote in message > news:cu**********@newsfeed.th.ifl.net... >> Hi Bill >> >> What I basically want to do is redirect the user to an aspx, but at >> the >> server side I want it to wait until a response has been posted back from > the >> client side before continuing execution. >> >> Any ideas? >> >> Thanks >> Kev >> >> "William F. Robertson, Jr." <th****@nameht.org> wrote in message >> news:es**************@tk2msftngp13.phx.gbl... >> > Typically when you spawn another thread, the original request
thread > will >> > have completed and no longer be around. >> > >> > If you are blocking on the request thread until your spawned is > completed, >> > could you just not use a return value from your spawned thread? >> > >> > bill >> > >> > "Mantorok" <no**@tiscali.co.uk> wrote in message >> > news:cu**********@newsfeed.th.ifl.net... >> >> Hi all >> >> >> >> When I start a new thread that tries to call: >> >> >> >> HttpContext.Current.Response.Redirect() >> >> >> >> It fails as Current returns null, is there anyway to access the >> >> current >> >> httpcontext from within a new thread? >> >> >> >> Thanks >> >> Kev >> >> >> >> >> > >> > >> >> > >
I guess I am being hard headed. Or just dumb, but I still don't see what
you are trying to accomplish.
Why don't you take you PageShower class and place it into session. Then
after the page redirects, you can pull the same object out of Session and
call another method.
Remove the Sleep method from the ShowAndWait method.
One of the rules I go with on Threading, it you can't think of a good reason
why you are using threading, then don't. If your only reason is, I thought
"it" would be better, it probably isn't.
HTH,
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message
news:cu**********@newsfeed.th.ifl.net... Hi bill
Well, here is a typical example of what I want to do...
public class PageShower { public void ShowAndWait() { // Redirect then wake up when required HttpContext.Current.Response.Redirect("wizard.aspx ", false);
// Sleep Sleep(); } }
I want the redirect to happen while the class waits, it will then be subsequently woken up later on. Ignore the other thread for now, I though threading may be able to provide a solution on this matter.
HTH Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Response.Redirect( newPage, false ) -- Will continue execution and just add the Redirect header to the outgoing request.
Response.Redirect( newPage, true ) -- Will cause a thread abort
exception and the Redirect header to the outgoing request.
Can you not place your class in Session?
I am still not sure where the spawned thread is coming in.
bill
"Mantorok" <no**@tiscali.co.uk> wrote in message news:cu**********@newsfeed.th.ifl.net... I have a class that redirects the user to a page, but I want the class
to stay "alive" until the page has been posted from the user.
As you know the Response.Redirect stops all execution, the behaviour I want is for the page to still post but for the execution to continue.
HTH Kev
"William F. Robertson, Jr." <th****@nameht.org> wrote in message news:eW**************@TK2MSFTNGP09.phx.gbl... >I am not exactly sure what you are wanting to do. > > The user makes a request to Page1.aspx. > Page1.aspx starts ThreadA. > ThreadA waits until Page1.aspx has been posted from the same user. > ThreadA starts processing. > > bill > > > "Mantorok" <no**@tiscali.co.uk> wrote in message > news:cu**********@newsfeed.th.ifl.net... >> Hi Bill >> >> What I basically want to do is redirect the user to an aspx, but at >> the >> server side I want it to wait until a response has been posted back from > the >> client side before continuing execution. >> >> Any ideas? >> >> Thanks >> Kev >> >> "William F. Robertson, Jr." <th****@nameht.org> wrote in message >> news:es**************@tk2msftngp13.phx.gbl... >> > Typically when you spawn another thread, the original request
thread > will >> > have completed and no longer be around. >> > >> > If you are blocking on the request thread until your spawned is > completed, >> > could you just not use a return value from your spawned thread? >> > >> > bill >> > >> > "Mantorok" <no**@tiscali.co.uk> wrote in message >> > news:cu**********@newsfeed.th.ifl.net... >> >> Hi all >> >> >> >> When I start a new thread that tries to call: >> >> >> >> HttpContext.Current.Response.Redirect() >> >> >> >> It fails as Current returns null, is there anyway to access the >> >> current >> >> httpcontext from within a new thread? >> >> >> >> Thanks >> >> Kev >> >> >> >> >> > >> > >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kerri |
last post by:
Hi,
I have do some Redirects in my applitcaion.
For example, when the use rhas logged in successfully I
redirect them to a different page.
In my Redirect all I was doing was a..
...
|
by: Peter Kirk |
last post by:
Hi there
I have a program written by another company (it's a "web control" which
returns a web-page: can I compare this to a servlet in the Java world?),
which they think is causing problems on...
|
by: VB Programmer |
last post by:
I have a default.aspx page that simply does this (in the "Try" block):
Response.Redirect("MyStartPage.aspx")
I keep getting this exception on this line:
"System.Threading.ThreadAbortException:...
|
by: Brian |
last post by:
I'm trying to response.redirect to another page on a button click event and I get an error message stating that the thread was being aborted (if I trap for the error that is...)
I've researched...
|
by: Robert Sorger |
last post by:
I have a problem with thread execution after calling response.redirect() in a
web form.
Basically, I want the thread to continue to work (e.g. do some long database
work) but want to redirect...
|
by: Niggy |
last post by:
I get an error - any help appreciated.
System.Threading.ThreadAbortException: Thread was being aborted. at
System.Threading.Thread.AbortInternal() at
System.Threading.Thread.Abort(Object...
|
by: Alan Silver |
last post by:
Hello,
I have a page that is supposed to do some checking, and if OK, set a
session variable before redirecting to another page. The following code
is a simplified version, I have hard-coded the...
|
by: Mark Huebner |
last post by:
I have an aspx web page with the following C# code in the page load event.
Can somebody tell me if the Response.Redirect() will cause my tLoadDNN
thread to stop executing before it is finished? ...
|
by: =?Utf-8?B?cGI=?= |
last post by:
I am having trouble doing a redirect in an async asp.net implemention.
Most of the time it works, but when it doesn't it just "hangs", the browser
never gets any return page. If I run it under the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |