Hello, if you simply make use of the static variable in your program then you can able to get the global varibles in asp.net as below:
Code:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial First : System.Web.UI.Page
{
protected void Page_Load(object obj, EventArgs ea)
{
string data = Global.ImportantData;
if (data == null)
{
data = DateTime.Now.ToString();
Global.ImportantData = data;
}
Important1.Text = data;
}
}
Bookmarks