Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - HttpContext is Nothing in new Thread inside a control

 
Thread Tools Search this Thread
Old 06-25-2003, 02:18 PM   #1
Default HttpContext is Nothing in new Thread inside a control


I start a parallel thread inside a control with the following code:

Private Sub StartParallelProc(ByVal Command As SqlClient.SqlCommand)

Dim T As New Threading.Thread(AddressOf ParallelProc)

Command.Parameters("MyID").Value = Guid.NewGuid.ToString

System.Web.HttpContext.Current.Session("ID") = Command

T.Start()

End Sub

Private Sub ParallelProc()

Dim Command As SqlClient.SqlCommand = DirectCast(System.Web.HttpContext.Current.Session( "ID") ,SqlClient.SqlCommand )

Command.ExecuteNonQuery()

'other code...


End Sub

The StartParallelProc procedure is called from the CreateChildControls of the Control.

Now, inside the ParallelProc, in the new thread, the System.Web.HttpContext.Current property appears to be Nothing.

Also if I try to access Page.Session property I have an error.

This does not happen if I have the same code inside a page instead of inside a control.

Any Idea, solution?

Do you know alternative ways to communicate between the threads (to pass the ID property and other info?)



Claudio Biagioli
  Reply With Quote
Old 06-25-2003, 03:08 PM   #2
Natty Gur
 
Posts: n/a
Default Re: HttpContext is Nothing in new Thread inside a control
As far as i know the only way to do it is to pass the Context as
parameter to the thread. let me know if you need a sample.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Natty Gur
  Reply With Quote
Old 06-25-2003, 04:57 PM   #3
William F. Robertson, Jr.
 
Posts: n/a
Default Re: HttpContext is Nothing in new Thread inside a control
I actually would like a sample of passing a parameter to a thread. I know
it it possible, but the only thing I could find was NOT passing it to the
thread.

Thanks,

bill

"Natty Gur" <> wrote in message
news:...
> As far as i know the only way to do it is to pass the Context as
> parameter to the thread. let me know if you need a sample.
>
> Natty Gur, CTO
> Dao2Com Ltd.
> 28th Baruch Hirsch st. Bnei-Brak
> Israel , 51114
>
> Phone Numbers:
> Office: +972-(0)3-5786668
> Fax: +972-(0)3-5703475
> Mobile: +972-(0)58-888377
>
> Know the overall picture
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!





William F. Robertson, Jr.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cisco VPN Restrict Access by IP ? samirise Hardware 1 12-16-2007 03:17 PM
Mind Control and CIA'S BOURNE IDENTITY PLOT soleilmavis@gmail.com DVD Video 2 08-03-2007 09:54 PM
Spoke to Spoke Enhanced Config (ASA-PIX) NEED HELP ASAP!! T-Mak Hardware 1 10-27-2006 11:56 AM
Pix506e behind Cisco1841 VPN problem aimeruko Hardware 0 09-27-2006 08:10 AM
FS: JP1 cable to program your universial remote control, now youcan control anything you want! Mike DVD Video 0 07-15-2005 02:46 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46