Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 11th, 2006, 05:32 PM
su su is offline
Authorized User
 
Join Date: Nov 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Global Variables in C#

Hi All,

I want to declare few global variable in my website's first page which I can use throughout the website. For ex. User_Login.

Among these global variables some of the values I will be getting it from database.

Does anybody have idea how to do this?

I am using C#.NET, Visual Web Developer & SQL Server 2000.

Please Help!
 
Old December 11th, 2006, 06:13 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Global variables can be made available a number of ways.

One way is to place it in the cache, another is to place it in an Application variable, another is to provide a static member of a class.

That is just a few for starters. There are other ways as well.


Woody Z
http://www.learntoprogramnow.com
 
Old December 11th, 2006, 06:18 PM
su su is offline
Authorized User
 
Join Date: Nov 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay..I figured out that I need to use session["var"] for my application.






Similar Threads
Thread Thread Starter Forum Replies Last Post
global variables Komila ASP.NET 3.5 Basics 2 October 31st, 2008 01:14 PM
Global variables zarol Beginning PHP 3 May 10th, 2005 06:17 AM
Global variables ps124 ASP.NET 1.0 and 1.1 Basics 6 April 6th, 2004 02:48 PM
Maintaining Global variables tenikiwon Beginning PHP 1 June 19th, 2003 02:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.