Solved

How to declare a Static variable in Global.asax?

Posted on 2006-11-19
2
1,852 Views
Last Modified: 2008-01-09
I'm using Visual Studio 2005 and VB.NET.  I'm in the Global.asax file.  I want to make a global variable that will be used by all pages and sessions.  I declared a practice variable "thisGlobals" to see how to declare a Static variable, but I get the error "'Static' is not valid on a member variable declaration".    I can't see where I'm missing it.  Can you show me how to declare a Static variable?  Thank you.

<%@ Application Language="VB" %>
<script runat="server">
    Public Static thisGlobals As String

...the other Global.asax code goes here.

</script>
0
Comment
Question by:psmithphil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
Nightman earned 500 total points
ID: 17975451
Use 'Shared' in VB.NET
Static is for C#
0
 

Author Comment

by:psmithphil
ID: 17975522
Thank you, Nightman!   In the Help, I never found anything that said this.  
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question