Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Global.asax file
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00694438
Message ID:
00694564
Vues:
14
>Have you tried including your code within a script tag inside the global.asax file?
>
>
><script runat="server">
>    <object id="MyObjectName" runat="server" scope="application" class="DotNetClassName" />
></script>
>
Yes. Unfortunately, that doesn't work either.

>Is there a reason why you are not using the Application object like the following:
>
>
>Application("MyObjectName") = myobject
>
>
>

No particular reason; I didn't even realize I could do that. I had just done a search on global properties and found the <object> tag info. It seemed like it would work exactly how I'd like. That is, from anywhere in my app I can just reference the object name.method/property. Since this is a security class, that's ideal.

How do I reference this new object? If I add a property to Global.asax:
public KirtlandAssociates.Web.WebSecurity.Security security = new KirtlandAssociates.Web.WebSecurity.Security(); 
Then, in Application_Start I add this code:
// Application["Security"] didn't work
Application["KirtlandAssociates.Web.WebSecurity.Security"] = this.security;
Now, I'd like to be able to access this new object. I tried accessing it from a web page using:
KirtlandAssociates.Web.WebSecurity.Security security = (KirtlandAssociates.Web.WebSecurity.Security) Application["Security"];

// This fails w/Object reference not set to an instance of an object
Msg.Text = security.noAccessLink;
What's the syntax for this?

Thanks,
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform