asp.net1.1 threading problem

T

tasleem

Hi!

I am using thread to send multiple/bulk email. But my thread is not calling
the me method that send emails.
I work well on localhost. But when i upload it on server it didn't call the
method (sendNewsletter_1).
I am using following code
public static bool sendBulkEmail_1(int newsletterID)
{
m_newsletterID = newsletterID;
Thread threadMail = new Thread(new ThreadStart(sendNewsletter_1));
threadMail.IsBackground = true;
threadMail.Start();
Thread.Sleep(2000);
return true;
}
public static void sendNewsletter_1()
{
Log_1("SendNewsLetter"); //just write this test string to a file. Its just
or testing.
}
 
M

Marc Gravell

Are you sure that perhaps it *is* calling it, but IIS (quite
reasonably) isn't allowing access to the file system?

This might be better aimed as an ASP.NET group

Marc
 
T

tasleem

no there is no Access issue, log function is called from thread creating
function
but and it is logged i mean values are written. so no access issue.
anything else or any other suggestion, to do such thing.
 
P

Peter Bromberg [C# MVP]

If you are going to send multiple emails like this, I suggest you use the
ThreadPool class via its QueueUserWorkItem method, and handle the email
sending in the asynchronous callback method. Much more efficient. You should
not need to sleep the thread for 2 seconds, I don't see where that
accomplishes anything other than to add an extra 2 seconds of time to every
call.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
 

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

Top