I have declared a static string “drivePath” in Gloabal.asax.cs. In Onstart event of webrole I am assigning a value to it. I am accessing this value on my web page but it shows as if the variable is just declared. The value I get for the My code is as follows
Global.asax.cs
public static string drivePath = string.Empty;
WebRole.cs
public override bool OnStart()
{
MountAzureDrive();
Global.drivePath = WebRole.drivePath;
return base.OnStart();
}
I am assigning value to WebRole.drivePath in “MountAzureDrive()” function.
On Web Page
On the web page in some function I am accessing the drivePath as “Global.drivePath” and I am getting value as string.Empty.
My question is Why is not preserving the value of drive path? What do I have to do, if I want to preserve the value of drivepath and get it?
Please help me
Thanks in advance.
OnStart (Role) is in another process than your web page (pages, Global.asax ..). At least when using Full IIS mode.