Thanks Eliyahu,
I used your syntax:
Dim EnterTime As String = System.DateTime.Now.ToString
HttpContext.Current.Profile.GetPropertyValue(EnterTime)
but again the same error, here is the error details:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_global.asax.5_wxyugz"
StackTrace:
at ASP.global_asax.Session_Start(Object sender, EventArgs e) in
C:\Documents and Settings\saber\My Documents\Visual Studio
2005\WebSites\WebTesting\global.asax:line 27
at
System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e)
at System.Web.SessionState.SessionStateModule.OnStart(EventArgs e)
at
System.Web.SessionState.SessionStateModule.CompleteAcquireState()
at
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object
source, EventArgs e, AsyncCallback cb, Object extraData)
at
System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
Eliyahu Goldin said:
The syntax you are using is good for an aspx file for a page. In
global.asax Profile is not defined . You can access it via
HttpContext.Current with syntax:
HttpContext.Current.Profile.GetPropertyValue("EnterTime");
Eliyahu
"Saber" <saber[.AT.]oxin.ir> wrote in message
in <system.web> of web.config I've:
[...]
<profile>
<properties>
<add name="EnterTime" type="System.DateTime" allowAnonymous="true"/>
</properties>
</profile>
And in Session_Start of global.asax:
[...]
Profile.EnterTime = System.DateTime.Now '**** Line 26
But I get an error message in line 26:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."