Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Thread.Start not running anything?
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Fiona
18y
1.7k
1
Reply
Hi,
I'm new to threading and would appreciate a little help. Have looked around for answers to my problem, but can't find anything, even thought I'm sure it's easy!
I have a process in my ASP.NET app which takes a long time to complete (basically it creates a monster PDF file). What I would like to happen is for user to be able to click the button to create this file and then continue with their site experience while the file is generated in the background.
I thought threading might be the solution to this, so have come up with the following:
public
void
archiveSite()
{
ThreadStart threadFunc =
new
ThreadStart (threadedArchiveSite);
Thread fThread =
new
Thread (threadFunc);
fThread.Start ();
HttpContext.Current.Response.Write(fThread.IsAlive.ToString()); // this dumps "True"
}
public
void
threadedArchiveSite()
{
//do all the gubbins to create my PDF
}
Now, as much as calling archiveSite() now doesn't make the browser sit there like a lemon for five minutes, unfortunately the PDF isn't created.
There's no error in the code, because if I put a direct call to threadedArchiveSite() inside archiveSite() it works fine.
I know I muct be missing something here.
Any hints?
Thanks :D
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
project output not found
view as website after installing the project in the server