Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Request on Default.aspx every 5 minutes
mike24
#1 Posted : Friday, May 1, 2009 4:08:10 PM(UTC)
Groups: Member
Joined: 5/1/2009(UTC)
Posts: 5

Hi,
I have a very strange problem: Somewhat (!?!) calls the default page of my application exact every 5 minutes.
Is this a feature (a "hidden" cronjob) or a bug ?
mike
Ultidev Team
#2 Posted : Friday, May 1, 2009 5:03:42 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Mike,
it's not a bug. This feature keeps an app in memory to ensure fast first page serve time. To turn it off uncheck the "Always keep application in memory..." box. If you register an application programmatically, then please use /AppKeepRunning="false" when registering the app from Visual Studio-made installer, or /DontKeepRunning command line parameter, when registering an application using Cassini EXE.

Please let us if this information was helpful.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
mike24
#3 Posted : Saturday, May 2, 2009 5:41:29 AM(UTC)
Groups: Member
Joined: 5/1/2009(UTC)
Posts: 5

wow, that was fast, thanks a lot for this very helpful information ! :-) I need something like a "cronjob", so this feature can be used for this task I think.

The page Default.aspx is the login site of my application. Is there a way to find out, who calls this page (if UltiDev Cassini Web Server made the request, then it should run some tasks) ?
mike24
#4 Posted : Saturday, May 2, 2009 6:54:36 AM(UTC)
Groups: Member
Joined: 5/1/2009(UTC)
Posts: 5

I think I've already found a solution. If the following server variable is empty, then the request comes from the "UltiDev Cassini Web Server"

Code:
this.Request.ServerVariables["HTTP_USER_AGENT"]


mike24
#5 Posted : Saturday, May 2, 2009 7:46:47 AM(UTC)
Groups: Member
Joined: 5/1/2009(UTC)
Posts: 5

I've another last question: If I start the UltiDev Windows Service, it makes a request to Default.aspx instantly. Is it possible to find out whether the request is a startup-request (that's the case when Ultidev Windows Service just has started) or a "normal" keep-app-in-memory request ?

I hope you understand my question.... ;-)

thanks
mike
Ultidev Team
#6 Posted : Sunday, May 3, 2009 8:31:57 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hello, Mike.

To answer your first question, blank value of the "HTTP_USER_AGENT" service variable is the right way to tell between a browser and "everyone else". Blank value is not guaranteed to be uniquely Cassini's - any .NET application using WebRequest to call your application will have blank user agent value. Therefore, we have logged a feature request to make Cassini supply its own user agent value.

We suggest using following code snippet to make it future-proof:
Code:
string userAgent = this.Request.ServerVariables["HTTP_USER_AGENT"];
bool cassi--- !!!SPAM!!! ---epInMemoryPinger = string.IsNullOrEmpty(userAgent) || userAgent.ToLower().Contains("ultidev");
// Use cassi--- !!!SPAM!!! ---epInMemoryPinger flag to tell regular browser from Cassini.


Regarding your second question, to tell whether it's the first ping or a subsequent, you would have a code something like this:

Code:
// class member declaration, likely of Default.aspx.cs
volatile private static bool isFirstCassiniPing = true;
...
// Ping request handler - probably Page_Load() of the Default.aspx.cs
if(cassi--- !!!SPAM!!! ---epInMemoryPinger && isFirstCassiniPing)
{
isFirstCassiniPing = false;
// your logic
}


Please let us know if this information was helpful.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
mike24
#7 Posted : Friday, May 8, 2009 7:54:41 AM(UTC)
Groups: Member
Joined: 5/1/2009(UTC)
Posts: 5

Thanks a lot for your answer and the code snippet ! I had to put the declaration of isFirstCassiniPing into a separate class, now all works perfectly.

mike
Ultidev Team
#8 Posted : Friday, May 8, 2009 10:57:04 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Not a problem, Mike. We're always glad to help.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (4)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.