Welcome Guest Search | Active Topics | Sign In | Register

Request is not available in this context Options
brado426
Posted: Wednesday, September 15, 2010 8:12:19 PM
Rank: Member
Groups: Member

Joined: 7/7/2007
Posts: 19
My application works fine in classic mode, but when I switch to integrated mode, EO.Web seems to have problems (stack trace below).

It appears to be blowing up in the Application_Start in my Global.asax.cs when I add my EO license and set some skins.

It says it is dying at line 51 which is the second call to "LoadMenuSkin".

EO.Web.Runtime.AddLicense(.......

Menu.LoadMenuSkin("~/Skin/StatusSelector.EO.Menu.ascx", "StatusSelector");
Menu.LoadMenuSkin("~/Skin/SupervisorMenu.EO.Menu.ascx", "SupervisorMenu");
Menu.LoadMenuSkin("~/Skin/MyProgress.EO.Menu.ascx", "MyProgress");


Any hints on what I am doing wrong would be greatly appreciated.

Thanks,

Brad O.

_________________________________________________________

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpContext.get_Request() +11173096
EO.Web.Internal.ev.a(Boolean A_0, HttpApplication A_1) +256
EO.Web.WebControlBase..ctor(HtmlTextWriterTag tag, Type implType) +106
EO.Web.WebControl..ctor(HtmlTextWriterTag tag, Type implType) +19
EO.Web.BaseNavigator..ctor() +59
EO.Web.Menu..ctor() +24
EO.Web.Internal.id.d() +56
EO.Web.Internal.id..cctor() +228

[TypeInitializationException: The type initializer for 'EO.Web.Internal.id' threw an exception.]
EO.Web.Internal.id.a(String A_0, String A_1, NavigatorType A_2) +0
htrep.Library.Global.Application_Start(Object sender, EventArgs e) in C:\projects\rar\htrep.Library\Global.asax.cs:51

[HttpException (0x80004005): The type initializer for 'EO.Web.Internal.id' threw an exception.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4170257
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +205
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +336
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +350
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +382

[HttpException (0x80004005): The type initializer for 'EO.Web.Internal.id' threw an exception.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11301302
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4338644


eo_support
Posted: Wednesday, September 15, 2010 8:17:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Which version are you running?

Thanks
brado426
Posted: Wednesday, September 15, 2010 11:13:53 PM
Rank: Member
Groups: Member

Joined: 7/7/2007
Posts: 19
eo_support wrote:
Hi,

Which version are you running?

Thanks


I realized that this application was using an older version of EO so I just updated it to the latest (2010, 8.0), but it is still doing the same thing.

Brad O.
brado426
Posted: Saturday, September 18, 2010 10:28:44 AM
Rank: Member
Groups: Member

Joined: 7/7/2007
Posts: 19
Ok, I figured this out. I'm a bit new to integrated mode, so I was clueless at first.

You can't access the Request object in the context in the Application_Start event in the global.asax.cs. Apparently the LoadMenuSkin method in EO uses the Request object and the EO example suggests placing it in the Application_Start event.

I was able to fix this by placing the LoadMenuSkin method in the Application_BeginRequest event instead as follows:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
FirstRequestInitialization.Initialize(HttpContext.Current);
}

public class FirstRequestInitialization
{
public static void Initialize(HttpContext context)
{
if (s_InitializedAlready)
{
return;
}

lock (s_lock)
{
if (s_InitializedAlready)
{
return;
}

EO.Web.Runtime.AddLicense("........

Menu.LoadMenuSkin("~/Skin/StatusSelector.EO.Menu.ascx", "StatusSelector");
Menu.LoadMenuSkin("~/Skin/SupervisorMenu.EO.Menu.ascx", "SupervisorMenu");
Menu.LoadMenuSkin("~/Skin/MyProgress.EO.Menu.ascx", "MyProgress");

s_InitializedAlready = true;
}
}
}



It will still only run once when the application first starts.

I hope this helps others who run into the same problem. If anyone has a better solution than what I have come up with, I'd love to get your opinion.

Thanks,

Brad O.
eo_support
Posted: Saturday, September 18, 2010 11:23:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Ah. That makes perfect sense. Thanks for sharing!


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 cannot vote in polls in this forum.