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

Notification

Icon
Error

Global.asax not working in Ultidev web server
opusdei
#1 Posted : Friday, July 1, 2011 2:37:49 AM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Dear UltiDev Team,
Please help out, the Global.asax/Globax.asax.vb of my web application is not working with UltiDev cassini web server, but it is working with default visual studio web server and IIS web server. I have been using UltiDev cassini web server in my web apps, until now I started adding some functions in Global.asax file (in Application_Start), that I discovered this. I don't know where or what has gone wrong. Please help.
Thanks.
Ultidev Team
#2 Posted : Saturday, July 2, 2011 10:45:03 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)
Hi there!

Do any of the functions get called, or all of them don't get called?

Best regards,
UltiDev team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
opusdei
#3 Posted : Sunday, July 3, 2011 8:53:26 AM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Dear UltiDev Team,

All or none of them did not get called. Because the rest of the Functions are inherent from the Application_Start to execute. Please, is there a workaround to that or to the Global.asax.

Ok, here is part of my source code:


Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
Dim tdayDate As Date = Now
If conn.setupcomplete = "incomplete" Then
HttpContext.Current.Response.Redirect("~/Setup.aspx")
Else
''check usage duration
Dim lstrundt As Date = CDate(conn.lastrundate)
Dim initsetupdt As Date = CDate(conn.initsetupdate)
Dim dtdiff As Integer = (lstrundt - initsetupdt).Days
If dtdiff > 366 Then
''
End If
GenerateAppInfo()
GenerateSMSSettings()
scheduleServicesStarts()
''log last run date
conn.registerSetting("LastRunDate", tdayDate.ToString)
End If
End Sub


The Application_Start in the Global.asax is suppose to check if application setup has been done, if so every other functions are get called, if not it redirects to setup page.

Thanks in anticipation of your reply
opusdei
#4 Posted : Sunday, July 3, 2011 12:14:08 PM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Dear UltiDev Team,

I just found that it is only Application_Start that does not work, the Application_Error works.
So there may be something wrong somewhere with Application_Start on my app and UltiDev webserver.

Thanks
I wait for your rply
Ultidev Team
#5 Posted : Monday, July 4, 2011 10:47:58 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)
Hi there!

Could you please confirm that when you put a debugger breakpoint in the Application_Start, you never hit the breakpoint? If you hit the break point, is HttpContext.Curren null (Nothing) or it has a meaningful value?

Thank you for helping us troubleshoot the issue.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
opusdei
#6 Posted : Thursday, July 7, 2011 6:47:06 AM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Hi UltiDev Team,

Ok, I have put a debugger breakpoint in the Application_Start and run the debug. It hit the breakpoint. What I got from the output window for HttpContext.Current is:

Name: HttpContext.Current
Value: {System.Web.HttpContext}
Type: System.Web.HttpContext

But, there is no problem I when run or debug with the Visual Studio web server, the Application_Start (in Global.asax) is executed. But, after compiling or packaging the web app and installed, when I run the Application_Start is skipped by the UltiDev web server.
Please is there a way I can attach my files and send to you, may be it will be useful to you to help me out.
I have developed two different web apps to check out/discover the problem, still it persists.
Or any workaround to that. Please, I'm running out of my development timeline.

Thanks in anticipation of your reply.
Ultidev Team
#7 Posted : Thursday, July 7, 2011 8:54:33 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)
Hi there!

Unfortunately we can't debug customer's applications unless we are reasonably certain it's a bug in our system. In this case, we are pretty sure Cassini is behaving properly. We have created following example to test it:

Global.asax:
Quote:
public class Global : System.Web.HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["Started"] = DateTime.Now;
Application["Context"] = HttpContext.Current != null && HttpContext.Current.Request != null ? HttpContext.Current.Request.Url.ToString() : "[No request]";
}
}

Default.aspx
Quote:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.TestStartApplicationGlobalAsax();
}

private void TestStartApplicationGlobalAsax()
{
object startedRaw = Application["Started"];
Label1.Text = "Started: " + (startedRaw == null ? "[NULL]" : ((DateTime)startedRaw).ToString());
Label1.Text += "<br/>Context: " + Application["Context"];
}
}


Default.aspx rendred under UltiDev Cassini:
Quote:
Started: 7/7/2011 9:47:00 AM
Context: http://localhost:51594/Default.aspx


We suggest attaching Visual Studio debugger to UltiDev Cassini process and debug to see what's going on.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
opusdei
#8 Posted : Friday, July 8, 2011 5:09:12 AM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Hi UltiDev Team,

OK, can you hint me on how to attach Visual Studio debugger to UltiDev Cassini process? So that I will do that.

Thanks in anticipation of your reply.
Ultidev Team
#9 Posted : Friday, July 8, 2011 8:55:23 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)
Hi!

You can use UltiDev Cassini for debugging in two different ways:
- Start UltiDev Cassini from Visual Studio.
- In Visual Studio do Debug | Attach to Process, and select UltiDevCassiniWebServer2a.exe, and then register your application with UltiDev Cassini service using Cassini Explorer.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
opusdei
#10 Posted : Saturday, July 9, 2011 11:58:58 AM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Hi UltiDev Team,

Everything worked fine when I attached and debugged with Ultidev web server (in console) using visual studio.
But, I'm still having the problem when I deployed and installed the web app. I'm yet to find the solution.

I just found out from the installed web app, that, the Application_Start responds, and skips by the time I run the web app the second time, that is, it's a bit unstable. I installed the web app on two different computers, yet the issue still persisted (i.e, inconsistency). Now, I suspect my web app. Could there be anything in a web app that could affect the performance of Ultidev web server. (either in web.config, or ).
I'm confident that the issue will be resolved since the Global.asax is confirmed working.

Thanks while I wait for your further assistance.
Ultidev Team
#11 Posted : Saturday, July 9, 2011 5:49:16 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)
Hi there.

Application_Start() is called only once when application gets loaded. All subsequent requests will not be passed to Application_Start(). Only after application has been unloaded, or server restarted - then Application_Start() will be called again, once. Your redirection logic probably does not belong where it is in the the first place. Instead you probably need to put it into Application_BeginRequest() instead - then every request will be checked and redirection should work. Other than that we can't think of how else we could be of help.

All the best,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
opusdei
#12 Posted : Saturday, August 20, 2011 12:25:20 PM(UTC)
Groups: Member
Joined: 10/6/2010(UTC)
Posts: 11
Location: Nigeria

Hi UltiDev team,

I appreciate your assistance so far. I have being available to solve the problem, by rewriting entirely the logic of the whole application.
On this note, I say that the Globax.asax works very well in or with the Cassini Web server.

I'll be trying Cassini web server Pro with my next application.

Thanks once more for assistance.
Ultidev Team
#13 Posted : Saturday, August 20, 2011 2:14:47 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)
Not a problem!

Glad we were able to help. Please test UltiDev Web Server Pro so we could fix bugs before you ship it with your applications.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Guest
#15 Posted : Monday, September 7, 2015 7:55:42 PM(UTC)
Groups:

Message was deleted by a Moderator.
Guest
#16 Posted : Tuesday, September 8, 2015 1:49:18 AM(UTC)
Groups:

Message was deleted by a Moderator.
Rss Feed  Atom Feed
Users browsing this topic
Guest (6)
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.