I am trying to add the following clean up code to the Global.aspx file, and in the clean up code which I got from http://msdn.microsoft.com/en-us/library/ms979200.aspx#scalenethowto08_topic11 we have to declare <%@ Import Namespace="ServiceNameSpace" %>
in global.aspx file and add the following code to global.aspx
protected void Session_Start(object sender, EventArgs e) { //this is needed so we don't generate a new session with each request Session["valid"] = true; } protected void Session_End(Object sender, EventArgs e) { TempDataStore.Remove(Session.SessionID); } protected void Application_End(Object sender, EventArgs e) { TempDataStore.ClearAll(); }
Now, after I add <%@ Import Namespace="ServiceNameSpace" %> then its throwing the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'ServiceNameSpace' could not be found (are you missing a using directive or an assembly reference?)
If I remove <%@ Import Namespace="ServiceNameSpace" %> and continue to add the clean up code then its throwing the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'TempDataStore' does not exist in the current context
Source Error:
Line 126:protected void Application_End(Object sender, EventArgs e)
Line 127:{
Line 128: TempDataStore.ClearAll();
Line 129:
Line 130:
Source File: c:\inetpub\vhosts\upaaza.com\httpdocs\Global.asax Line: 128
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'TempDataStore' does not exist in the current context
Source Error:
Line 133:protected void Session_End(Object sender, EventArgs e)
Line 134:{
Line 135: TempDataStore.Remove(Session.SessionID);
Line 136:
Line 137:
Source File: c:\inetpub\vhosts\upaaza.com\httpdocs\Global.asax Line: 135
Hi, have you included the file Util.cs in your project since this is the file where the namespace 'ServiceNameSpace' is declared (as well as the class TempDataStore) ?
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'ServiceNameSpace' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 1: <%@ Application Language="C#" %>
Line 2: <%@ Import Namespace="ServiceNameSpace" %>
And if I dont include <%@ Import Namespace="ServiceNameSpace" %> in the global.asax file then its throwing the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'TempDataStore' does not exist in the current context
Source Error:
Line 14: protected void Application_End(Object sender, EventArgs e)
Line 15: {
Line 16: TempDataStore.ClearAll();
Line 17: }
Line 18:
Hi, have you included the file Util.cs in your project since this is the file where the namespace 'ServiceNameSpace' is declared (as well as the class TempDataStore) ?
Regards, Wolfgang
In the util.cs file, do I need to write something else here "using ServiceNameSpace.localhost;" , It says localhost there.....so am I supposed to replace it with something?
nikhil2507
0 Points
4 Posts
Global.aspx Doesnt Accept <%@ Import Namespace="ServiceNameSpace" %>
May 26, 2010 08:16 PM|LINK
Hello,
I am trying to add the following clean up code to the Global.aspx file, and in the clean up code which I got from http://msdn.microsoft.com/en-us/library/ms979200.aspx#scalenethowto08_topic11 we have to declare <%@ Import Namespace="ServiceNameSpace" %> in global.aspx file and add the following code to global.aspx
wosi
Member
469 Points
95 Posts
Re: Global.aspx Doesnt Accept <%@ Import Namespace="ServiceNameSpace" %>
May 30, 2010 08:57 AM|LINK
Hi, have you included the file Util.cs in your project since this is the file where the namespace 'ServiceNameSpace' is declared (as well as the class TempDataStore) ?
Regards, Wolfgang
ramiramilu
All-Star
95275 Points
14072 Posts
Re: Global.aspx Doesnt Accept <%@ Import Namespace="ServiceNameSpace" %>
May 30, 2010 09:17 AM|LINK
Is ClearAll() is a static method???? if so try by using the fully qualified name...like...
ServicenameSpace.TempDataSource.ClearAll();
or else try like this....
ServicenameSpace.TempDataSource t = new ServicenameSpace.TempDataSource();
t.clearAll();
and also cross check the names....similarly for Remove()....
JumpStart
nikhil2507
0 Points
4 Posts
Re: Global.aspx Doesnt Accept <%@ Import Namespace="ServiceNameSpace" %>
May 30, 2010 08:54 PM|LINK
And if I dont include <%@ Import Namespace="ServiceNameSpace" %> in the global.asax file then its throwing the following error:
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0103: The name 'TempDataStore' does not exist in the current context Source Error: Line 14: protected void Application_End(Object sender, EventArgs e) Line 15: { Line 16: TempDataStore.ClearAll(); Line 17: } Line 18:nikhil2507
0 Points
4 Posts
Re: Global.aspx Doesnt Accept <%@ Import Namespace="ServiceNameSpace" %>
May 30, 2010 08:57 PM|LINK
Hello ramiramilu,
Thanks for your suggesttions, I implemented them but its not working in my case :(
nikhil2507
0 Points
4 Posts
Re: Global.aspx Doesnt Accept <%@ Import Namespace="ServiceNameSpace" %>
May 30, 2010 08:59 PM|LINK
In the util.cs file, do I need to write something else here "using ServiceNameSpace.localhost;" , It says localhost there.....so am I supposed to replace it with something?