473,473 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Assembly Compilation!

Hi all,
I am trying to compile an assembly.

#Code Snippets.

Imports System
Imports System.Web.SessionState.HttpSessionState

Public Function GetGroup() As String

Return Session("GroupId")

End Function

cd mypath
vbc /t:library /r:System.dll /r:System.Web.dll
/out:../../../bin/Security.dll security.vb
pause

I keep getting an error 'Session' is undefined.

Can someone enlighten me as to what i am doing wrong?


Nov 19 '05 #1
1 924
The Session property is a member of classes which implement
System.Web.IHttpHandler System.Web.IHttpModule, and is a part of the
System.Web.HttpContext passed to an IHttpHandler or IHttpModule, such as
System.Web.UI.Page.

Assuming that your class is supposed to work in the context of a Page, you
can obtain a reference to the current Session via the static
System.Web.HttpContext.Current.Handler property. Example:

Dim Session as System.Web.SessionState.HttpSessionState

If Not IsNothing(System.Web.HttpContext.Current.Handler) Then
Session = CType(System.Web.UI.Page)
System.Web.HttpContext.Current.Handler
Return Session("GroupId")
End If
Return ""

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:eS*************@TK2MSFTNGP12.phx.gbl...
Hi all,
I am trying to compile an assembly.

#Code Snippets.

Imports System
Imports System.Web.SessionState.HttpSessionState

Public Function GetGroup() As String

Return Session("GroupId")

End Function

cd mypath
vbc /t:library /r:System.dll /r:System.Web.dll
/out:../../../bin/Security.dll security.vb
pause

I keep getting an error 'Session' is undefined.

Can someone enlighten me as to what i am doing wrong?

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some...
18
by: Praveen Ramesh | last post by:
Hi, Is there any way to add the @Assembly reference to the aspx files programmatically from inside a custom control (when it gets dropped on to the page from the toolbox)? I have a custom...
3
by: Jim | last post by:
Hi, I have an assembly and it's satellite in my GAC. I have referenced the DLLs in my project (from the same location where I added it to the GAC). CopyLocal is set false. When I run the...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
6
by: Philipp Schmid [MSFT] | last post by:
I am trying to add a Generic Handler (ASHX) to my web site solution. In order to do that I have to specifiy an assembly name in the web.config file. But since 2.0 web sites are no longer...
2
by: john | last post by:
Maybe I haven't had that "a-ha" moment yet, but I think the new approach to web projects is a step in the wrong direction. My main beef is that control over the assembly generation process has...
0
by: qiang | last post by:
Hi everyone, Could you please take a look at an exception for ASP.NET application? My ASP.NET application is using Infragistics WebChart control. I encounter an exception below when...
1
by: Andrew | last post by:
In ASP.NET 1.1 I used to retreive the version of my code-behind assembly using following syntax: Assembly.GetExecutingAssembly().GetName().Version The version was defined in AssemblyInfo.cs using...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
2
by: antonyliu2002 | last post by:
I am testing AJAX. I've downloaded the AJAX Extension and the CTP December package and installed on BOTH my development machine and the production server. Then I created a very very simple web...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.