473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Issue with ASP.NET 2.0 Global asax

For some odd reason I have notices that every time I refreshed a page
in my browser ( same session ) ASP.NET called : void
Application_Start(object sender, EventArgs e)

I am absolutly confused since nothing in my code resets the
application.
the session variables seem to be untoutched.

does any one else have this kind of problem?

maybe im missing some information here. Can anyone throw out some ideas
?

Best Regards,
Alexandre Brisebois

Jan 12 '06 #1
13 3584
This in the Global.asax?

Strange, this event is trigger every time you recompile , or reestart
the server.

Do you have any special setting on your IIS or in the machine.config?

Jan 12 '06 #2
I dont think I have any special settings, I had my hosting install
asp.net 2.0 a few weeks ago and have runinto a few problems, I do not
know if they installed everything properly or so, I also was faced with
file permission problems, but no this is happenning even
if I set session to timeout at 20 mins

and even when I dont compile..

though I must mention this is not the root application in the tree, but
it is the only application in its application pool.

im absolutly out of ideas ..

Jan 12 '06 #3
P.S. the web application is not published it is only compiled on the
remote server.

Jan 12 '06 #4
Yes the application compiled or released ... dunno if this have
anything to do with it but Debug sometimes break things, that in
release works fine

Jan 12 '06 #5
I will try a Publish, and get back to you on that

Jan 12 '06 #6
Even after publish the problem occurs over and over again,
here is my code:

void Application_Start(object sender, EventArgs e)
{
Live.Config.Instance.DirectoryAbsoluteLocation =
Server.MapPath("App_Data/");
Live.Config.Instance.LocationConfig =
Live.Config.Location.Server;

System.IO.FileInfo MenuXML = new
System.IO.FileInfo(Config.Instance.DirectoryAbsolu teLocation +
@"\Menu.xml");
if (MenuXML.Exists)
{
if (Application["BaseMenu"] != null &&
Application["MenuLastWriteDate"] != null)
{
if
(Application["MenuLastWriteDate"].ToString().CompareTo(MenuXML.LastWriteTimeUtc.ToS tring())
!= 0)
{

loadMenuFromXml(MenuXML);
}
}
else
{
loadMenuFromXml(MenuXML);

}
}

}
private void loadMenuFromXml(System.IO.FileInfo MenuXML)
{
Live.Components.Menu Switcher = new Live.Components.Menu();
Live.XML.LoadState ls = new Live.XML.LoadState();
ls.Load(Switcher);
Application["MenuLastWriteDate"] =
MenuXML.LastWriteTimeUtc.ToString();
Application["BaseMenu"] = Switcher;
}

in the code above, I should only load up a Menu from the XML file when
the File last write datetime changes. and it should only be called on
app start.

what I am getting is that the menu gets loaded everytime the time
changes even if I have not changed sessions (simple refresh)

Jan 12 '06 #7
Alexandre wrote:
For some odd reason I have notices that every time I refreshed a page
in my browser ( same session ) ASP.NET called : void
Application_Start(object sender, EventArgs e)

I am absolutly confused since nothing in my code resets the
application.
the session variables seem to be untoutched.


Are you using InProc Session state?

Monitor the ASP.NET v2.0.50727 object's Application Restarts counter and see
if it increments as well. If it does, you can use health monitoring to log
app restarts and the reason for them. If you don't know how to do that, let
me know and I can post some sample code.

--
Jim Cheshire
================================
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 12 '06 #8
I am using InProc state

I have not used the health monitoring yet but I guess nows the best
time to learn.
could you showme some sample code ?

regards,

Jan 13 '06 #9
Alexandre wrote:
I am using InProc state

I have not used the health monitoring yet but I guess nows the best
time to learn.
could you showme some sample code ?


The fact that your'e using InProc Session state AND you say that Session
state is being maintained tells me that the app domain isn't recycling.
However, I'd still be curious to know if the perfmon counter I mentioned
increments. Does it?

--
Jim Cheshire
================================
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 13 '06 #10
i used a simple Application[] and incrementing an int inside of it

curiously its not incrementing
but the menu refreshes :S:S

then i check if the loading method was being called it is not ...
the increment sates as is = to 1

either the App variables are being reset or something is really weird.

Jan 13 '06 #11
I have been checking everywhere if by any chance I was reloading the
menu, and no other menthods refresh the menu.

Application[] seem not to change and Session is kept as is :S

Jan 13 '06 #12
Summary of symptoms:

using (Session[])
Session is kept

using (Application[])
Increments in loadMenuFromXml(System.IO.FileInfo MenuXML) <- some how
executed without incrementating :S

AND in Application_Start(object sender, EventArgs e)

do not increment

using (Application[])
increment in web user control increments

Jan 13 '06 #13
I found the problem, this might be interesting for any one working
through hVisual Studio 2005. When you modify a file through VS2k5 in my
case its an xml file place in the App_Date directory. The simple fact
of saving the file restarts the application.

when modifying the file through a normal externam ftp the app is not
affected.

thank you all for your time and patience, I greatly apreciated all your
inputs.

Regards,

Jan 13 '06 #14

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

Similar topics

5
by: John Christensen | last post by:
I'm currently having an issue while trying to deploy a new ASP.NET application from my personal machine to our development web server. After I copy the folder over and create an IIS application in...
12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
4
by: John A Grandy | last post by:
I installed VS05 RC , created a new Web Site , but I do not see Global.asax , and I do not see Global.asax.cs in the App_Code dir ......
5
by: Tony | last post by:
Hi all, Here's the link to the issue we were seeing on our ASP.NET system when modifying, adding and deleting directories in framework 2.0....
4
by: Al Santino | last post by:
Hello, I've created a simple C# web services project using Visual Studio 2005. My service compiles and runs correctly when called by remote clients. I'm able to step through the service in the...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
15
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.