Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Global.asax visibility
Message
 
À
02/05/2008 16:18:00
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01314860
Message ID:
01314874
Vues:
11
>Hi all,
>
>I have a web application project and a problem with visibiltiy to the Global.asax class.
>
>In my Global.asax I have a public variable such as this:
>
>
>
>Public Class Global_asax
>	Inherits System.Web.HttpApplication
>
>	Public Shared MyString As String
>         ... All the other event stuff
>End Class
>
>
>I am setting the value of the variale in the Application_Start Event
>
>Now in the same web project I have a class with a namespace of
>Namespace Main.Managers
>the full namespace would be the project root plus Main.Managers so
>MyApplication.Web.Main.Managers
>
>Inside this class I am trying to reference the Shared (static)variable such as this:
>
>
>
>If (MyString = "SomeValue") Then
>
>
>What I get is an error indicating MyString is not declared.
>What am I doing wrong here as I expected the Shared variable to be available in the Global.asax file.

It is, but it can't resolve the full namespace based off your imported namespaces. Try something like:
If (Global_asax.MyString = "SomeValue) Then
-Paul

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

Click here to load this message in the networking platform