?
Solved

application restart

Posted on 2003-03-18
12
Medium Priority
?
266 Views
Last Modified: 2010-04-06
hi all :)
i have a C# compiled assembly under myWebApp\bin
i am able to call the classes from the namespaces in the dll.
the global.asax application onStart contains a code line that initialize some static classes in the dll:
<%@ Import namespace="com.tm.application" %>

     <script language="C#" runat="server">
         
          public void Application_OnStart()
          {
                TMApplication.init();
          }

     </script>
the problem is that EVERY time i refresh the aspx page that calls classes in the dll
the Application_OnStart is invoked and my application inits.
10x.
0
Comment
Question by:shez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 14

Expert Comment

by:avner
ID: 8165732
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_the_application_onstart_function.asp

The application_onstart should run "any .asp files are processed "


What is it that you try to do ?
0
 
LVL 6

Expert Comment

by:thomasdodds
ID: 8167898
set a session variable as a flag ans check for it in the onstart sub... refreshing a page doesn't reset the session, so you should be able to control the firing of your code

"the problem is that EVERY time i refresh the aspx page " ... that's the way it's designed to work ... if you refresh the page you refresh the application, but not the session
0
 

Author Comment

by:shez
ID: 8172658
as far as i understand it the Application_OnStart event is fired only 1 time in the application life cycle.
maybe i got it wrong but it seems absurd that every request
will restart the application.

loading each user(session) with a flag couldn't be the right solution.
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:shez
ID: 8172774
as far as i understand it the Application_OnStart event is fired only 1 time in the application life cycle.
maybe i got it wrong but it seems absurd that every request
will restart the application.

loading each user(session) with a flag couldn't be the right solution.
0
 
LVL 14

Expert Comment

by:avner
ID: 8172853
I was unable to find a clear answer, but maybe you need to look into the direction of how the "default application" is defined in your IIS.
0
 

Author Comment

by:shez
ID: 8182136
i got it :)
asp.net constantly monitors all file types under \bin.
any changes to these files causes the application to restart which makes sense cause \bin is the app dir.
all my log files were written to \bin\logs.
so this what happened:
1. asp application started.
2. Application_OnStart called.
3. dll initialized.
4. during dll init log file written.
5. asp application restarted.

what do i do with the points now?
0
 
LVL 14

Expert Comment

by:avner
ID: 8193418
If what you are suggesting is right, then what if you write the logs to any directory that is not under \bin ?
0
 

Author Comment

by:shez
ID: 8194084
already did avner.
0
 
LVL 14

Expert Comment

by:avner
ID: 8194098
And did it work ?
0
 

Author Comment

by:shez
ID: 8194176
yep.
you want the points abe?
0
 
LVL 14

Accepted Solution

by:
avner earned 1200 total points
ID: 8194186
Yes. But this is only if I helped you getting to a solution.
0
 
LVL 14

Expert Comment

by:avner
ID: 8194555
Thanks .
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question