Welcome Guest Search | Active Topics | Sign In | Register

Problem moving from license key from global.asax to global.asax.cs Options
ckmba
Posted: Thursday, April 27, 2017 10:40:29 PM
Rank: Member
Groups: Member

Joined: 4/25/2013
Posts: 17
Greetings, we have been running EO on our ASP.NET WebForms site for years now with no problem. However, recently we started updating our web files to also support MVC. One of the updates that we needed to do was modify our global.asax file...and in MVC the file has a code behind global.asax.cs.

Anyways, we copied the license key info from the global.asax to the global.asax.cs file but now it put all of our stuff in "Trial Mode". Are we doing something wrong? I tried just keeping our old global.asax file (and not having a code-behind) but even after trying to import namespaces I can't get MVC to work. So at this point either MVC works or EO works...I can't get them both to work. :(


//---
//OLD GLOBAL.ASAX FILE
//---
<%@ Application Language="C#" %>
<script runat="server">

void Application_Start(object sender, EventArgs e)
{

//Essential Objects Web Objects License (2015)
EO.Web.Runtime.AddLicense(
"....");

//Essential Objects PDF License (2015)
EO.Pdf.Runtime.AddLicense(
"...");

//Turn Off Client-Side Debugging
EO.Web.Runtime.DebugLevel = 0;
}
</script>


Code: C#
//---
//NEW GLOBAL.ASAX.CS File
//---
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using System.Web.Http;
using System.Web.Optimization;

namespace myApp.mvc
{
    public partial class MvcApplication : System.Web.HttpApplication
    {


        /// &lt;summary&gt;
        /// Application Start
        /// &lt;/summary&gt;
        protected void Application_Start()
        {
            //Essential Objects Web Objects License (2015)
            EO.Web.Runtime.AddLicense(
                "...");


            //Essential Objects PDF License (2015)
            EO.Pdf.Runtime.AddLicense(
                "...");

            //Turn Off Client-Side Debugging
            EO.Web.Runtime.DebugLevel = 0;


            //--------------------------
            //MVC-Related Configuration
            //--------------------------
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

        }
    }
}


Thanks in advance for your assistance!
eo_support
Posted: Friday, April 28, 2017 12:38:59 PM
Rank: Administration
Groups: Administration

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

There should not be any material difference between calling the license code in your Application_Start handler or in your Application class's Application_Start method. The issue most likely be caused by something else ---- have you switched to a different version of EO library? Or your license code has indeed been called?

Thanks!
ckmba
Posted: Monday, May 1, 2017 12:30:21 PM
Rank: Member
Groups: Member

Joined: 4/25/2013
Posts: 17
Ok, I got it. I didn't realize that the global.asax.cs file gets compiled into a dll along with the rest of our MVC .cs files. We were never able to get our WebForms and MVC files to compile in a single project so our MVC files live in a separate project (which didn't have the EO license). I put the EO license info in the MVC project, compiled the project, and moved the dll to our WebForms website and it worked. Sorry for the inconvenience!
eo_support
Posted: Monday, May 1, 2017 12:50:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Great. Glad to hear that you resolved the issue!


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.