473,789 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: Server.Execute throws exception in Application_Sta rt

Hi, all:

I tried to call Server.Execute in Application_Sta rt
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_Sta rt. 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
4 1769
If you want a backgrould thread, then create a System.Threadin g.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_Sta rt 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_Sta rt. 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
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.Threadin g.Thread object.Server.Execu te is a sychronous mechanism to execute a second page from theexecution of a first page.

-Brock
DevelopMento r
http://staff.develop.com/ballen

Hi, all:

I tried to call Server.Execute in Application_Sta rt 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_Sta rt. 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
> 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_Sta rt?

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

Nov 19 '05 #4
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_OnS tart(object sender,EventArg s e)
{
ThreadPool.Queu eUserWorkItem(n ew WaitCallback(Ru nUrl));
}

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_Sta rt?

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

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2600
by: kaiwing18 | last post by:
Hi , I have a problem relate to java and database. Could anyone answer me ?Please see the following code. import java.sql.*; public class Result { public static void main(String args) {
0
3146
by: HiChetu | last post by:
hi All, Connection Pool - Does not check for Server Status. Here is the scenario : 1) SQL Server is up 2) Create a connection pool for a particular connection string by repeatedly executing the same query in .NET ( using SqlConnection and SqlCommand classes )
3
7272
by: Kian Goh | last post by:
Hi, Can somebody tell me why can't I use string strPath = Server.MapPath(Request.ApplicationPath); in protected void Application_Start(...) It compiles ok but an unhandled exception occurred during the execution. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
9
4615
by: Mark | last post by:
Hello I'm trying to use a Server.Transfer in a try-catch (I cannot put it outside the Try-Catch as it is nested deep within a component that is called in a try-catch loop) The problem is that the Server.Transfer always throws the ThreadAbortException. MSDN acknowledges that this is a unque exception that will be automatically rethrown - i.e. it can't be swallowed. Does anyone know if there is extar code I can write (maybe something in the...
0
970
by: Jon | last post by:
I have custom error handling configured for my application. In web.config I have: <customErrors defaultRedirect="ErrorDisplay.aspx" mode="On"> <error statusCode="404" redirect="Error404.htm"/> </customErrors>
1
2192
by: David Thielen | last post by:
Hi; If an exception is thrown in the global.asax Application_Start then calling HttpApplication.Server.Transfer throws an exception. How can I tell from the HttpApplication object if it is ok to call Transfer? -- thanks - dave david_at_windward_dot_net
1
1727
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class (derived from System.Web.UI.Page). So, for instance, my home page's inheritance chain looks like this: HomePage Inherits WebPageBase
2
2623
by: dmstn | last post by:
Hey! I've got a little problem. I have to make a web site for a university essay. I curently have to create a search engine. Users can enter a hotel name in a search bar and results have to appear in another screen. All of this has to be done with java servlets. I think there's something I don't see and it's wrong. My problem is that anything I enter in the search bar appears as a result in the results page, even if there's not such a name in...
6
2986
by: zaina | last post by:
hi everybody i am nwebie in this forum but i think it is useful for me and the member are helpful my project is about connecting client with the server to start exchanging messages between them. to be more clear we process this purpose we serve this to the student in the university. how?? student will send a message that contains his name,id and request by format the server want such as zaina-20024008-grade. the grade is the request...
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.