Click here to Skip to main content
15,910,797 members
Home / Discussions / C#
   

C#

 
GeneralRe: an application for showing shared files using c# and .net [modified] Pin
led mike11-Feb-08 8:13
led mike11-Feb-08 8:13 
Generalsystem.drawing.color [modified] Pin
s3rro11-Feb-08 7:11
s3rro11-Feb-08 7:11 
GeneralRe: system.drawing.color Pin
led mike11-Feb-08 8:07
led mike11-Feb-08 8:07 
GeneralRe: system.drawing.color Pin
Insincere Dave11-Feb-08 8:34
Insincere Dave11-Feb-08 8:34 
GeneralRe: system.drawing.color Pin
led mike11-Feb-08 8:38
led mike11-Feb-08 8:38 
GeneralRe: system.drawing.color Pin
s3rro11-Feb-08 8:53
s3rro11-Feb-08 8:53 
GeneralRe: system.drawing.color Pin
Pete O'Hanlon11-Feb-08 10:16
mvePete O'Hanlon11-Feb-08 10:16 
QuestionRequest is not available in this context Pin
Ryno Burger11-Feb-08 6:18
Ryno Burger11-Feb-08 6:18 
Hi guys

I have a function called SendEmail which runs within a thread.

This function simply send an email to the user.

However, I made a "Please Wait..." page while the email gets send in the background the user see the "Please Wait..." page.
<br />
<br />
public void SendEmail()<br />
        {<br />
            StringBuilder messageText = new StringBuilder();<br />
<br />
            messageText.AppendLine(string.Format("Name: {0} {1}", txtName.Text.Trim().ToString(), txtSurname.Text.Trim().ToString()));<br />
            messageText.AppendLine(string.Format("Contact Number: {0}", txtContactNumber.Text.Trim().ToString()));<br />
            messageText.AppendLine(string.Format("Email Address: {0}", txtEmail.Text.Trim().ToString()));<br />
            messageText.AppendLine(string.Format("Comments: {0}\n\n", txtComments.Text.Trim().ToString()));<br />
            messageText.AppendLine(string.Format("Quote Reference Nr: {0}", Request.QueryString["quoteNr"].ToString())); // Breaks here with error: Request is not available in this context<br />
<br />
            // Send the email to the user<br />
        }<br />


I call the SendEmail() function using the following lines of code:

<br />
Guid id = Guid.NewGuid();<br />
<br />
            ThreadStart ts = new ThreadStart(SendEmail);<br />
<br />
            Thread th = new Thread(ts);<br />
<br />
            th.Start();<br />
<br />
            Response.Redirect(string.Format("PleaseWait.aspx?ID={0}&type={1}", id, "email"));<br />


Is it true that you can't access Request data within a thread, if not, how do I then get access to Request.QueryString data?
GeneralRe: Request is not available in this context Pin
led mike11-Feb-08 6:22
led mike11-Feb-08 6:22 
GeneralRe: Request is not available in this context Pin
Ryno Burger11-Feb-08 6:27
Ryno Burger11-Feb-08 6:27 
GeneralRe: Request is not available in this context Pin
led mike11-Feb-08 6:47
led mike11-Feb-08 6:47 
GeneralRe: Request is not available in this context Pin
Not Active11-Feb-08 6:24
mentorNot Active11-Feb-08 6:24 
GeneralRe: Request is not available in this context Pin
Steve Westbrook11-Feb-08 6:38
Steve Westbrook11-Feb-08 6:38 
GeneralRe: Request is not available in this context Pin
leppie11-Feb-08 8:03
leppie11-Feb-08 8:03 
GeneralRe: Request is not available in this context Pin
led mike11-Feb-08 8:12
led mike11-Feb-08 8:12 
GeneralRe: Request is not available in this context Pin
Steve Westbrook11-Feb-08 13:52
Steve Westbrook11-Feb-08 13:52 
GeneralRe: Request is not available in this context Pin
led mike12-Feb-08 5:25
led mike12-Feb-08 5:25 
GeneralRe: Request is not available in this context Pin
Steve Westbrook12-Feb-08 6:14
Steve Westbrook12-Feb-08 6:14 
GeneralRe: Request is not available in this context Pin
led mike12-Feb-08 7:47
led mike12-Feb-08 7:47 
GeneralRe: Request is not available in this context Pin
Steve Westbrook12-Feb-08 16:07
Steve Westbrook12-Feb-08 16:07 
GeneralRe: Request is not available in this context Pin
blakey40411-Feb-08 22:29
blakey40411-Feb-08 22:29 
QuestionCell/Row DoubleClick event for DataGrid Pin
t4ure4n11-Feb-08 6:05
t4ure4n11-Feb-08 6:05 
GeneralRe: Cell/Row DoubleClick event for DataGrid Pin
Not Active11-Feb-08 6:21
mentorNot Active11-Feb-08 6:21 
GeneralRe: Cell/Row DoubleClick event for DataGrid Pin
t4ure4n11-Feb-08 6:31
t4ure4n11-Feb-08 6:31 
GeneralRe: Cell/Row DoubleClick event for DataGrid Pin
Not Active11-Feb-08 6:48
mentorNot Active11-Feb-08 6:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.