By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

Help: Server.Execute throws exception in Application_Start

P: n/a
Hi, all:

I tried to call Server.Execute in Application_Start
and got exception.
Any help is appreciated

You might ask why I want to do that in the first place.
Well, I need to
start a background thread in the Application_Start. This
background thread
need send Emails. The content of email is from executing
a webpage. In
short, this background need to call the Server.Execute
which throws exception.

frog
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If you want a backgrould thread, then create a System.Threading.Thread object.
Server.Execute is a sychronous mechanism to execute a second page from the
execution of a first page.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Hi, all:

I tried to call Server.Execute in Application_Start and got
exception. Any help is appreciated

You might ask why I want to do that in the first place. Well, I need
to start a background thread in the Application_Start. This background
thread need send Emails. The content of email is from executing a
webpage. In short, this background need to call the Server.Execute
which throws exception.

frog


Nov 19 '05 #2

P: n/a
Thanks for answering the question.

I need to send email in the background thread, and the
email content need to be generated from ASPX pages.

Well of course, I can use web-services to create this
email content...

But I am looking for a simpler solution.. Any help is
appreciated.
-----Original Message-----
If you want a backgrould thread, then create a System.Threading.Thread object.Server.Execute is a sychronous mechanism to execute a second page from theexecution of a first page.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Hi, all:

I tried to call Server.Execute in Application_Start and got exception. Any help is appreciated

You might ask why I want to do that in the first place. Well, I need to start a background thread in the Application_Start. This background thread need send Emails. The content of email is from executing a webpage. In short, this background need to call the Server.Execute which throws exception.

frog


.

Nov 19 '05 #3

P: n/a
> I need to send email in the background thread, and the email content
need to be generated from ASPX pages.


Can you explain a bit more? If the email needs to be send in the context
of a page, then why not just write the code in the page itself? Why Application_Start?

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4

P: n/a
Why dont you spawn a new thread on application on start that either creates a
a webrequest that invokes your .aspx page that appears to be sending out
emails. For a very crued example something like this would work:

private void Application_OnStart(object sender,EventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(RunUrl));
}

public void RunUrl(Object stateInfo)
{
Process.Start("explorer","http://www.google.com");
}

of course there are many ways to accomplish this task this is just a quick
and dirty methodology example.

"Brock Allen" wrote:
I need to send email in the background thread, and the email content
need to be generated from ASPX pages.


Can you explain a bit more? If the email needs to be send in the context
of a page, then why not just write the code in the page itself? Why Application_Start?

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.