I have a simular problem but am doign it the same way and its not erroring but it is also not getting a value.
I have session variables and one is Session("FtpFolder"). I need this value in the class file so that it knows where to save the file. I can see in the page with trace on that it has
a value. But when I want to use it in the class file it is not getting a value. The simplified code is below.
Imports
Microsoft.VisualBasic
Imports
System
Imports
System.Data
Imports
System.Configuration
Imports
System.Web
Imports
System.Web.Security
Imports
System.Web.UI
Imports
System.Web.UI.WebControls
Imports
System.Web.UI.WebControls.WebParts
Imports
System.Web.UI.HtmlControls
Imports System.IO
Dim strDirectory
As String
strDirectory = System.Web.HttpContext.Current.Session("FtpFolder")
uploadFile.SaveAs(String.Format("{0}{1}", strDirectory, uploadFile.FileName))
belcherman
Member
47 Points
112 Posts
Re: Using Session Variables inside a VB.Net Class File
Nov 05, 2007 01:18 PM|LINK
I have session variables and one is Session("FtpFolder"). I need this value in the class file so that it knows where to save the file. I can see in the page with trace on that it has a value. But when I want to use it in the class file it is not getting a value. The simplified code is below.
Imports
Microsoft.VisualBasicImports
SystemImports
System.DataImports
System.ConfigurationImports
System.WebImports
System.Web.SecurityImports
System.Web.UIImports
System.Web.UI.WebControlsImports
System.Web.UI.WebControls.WebPartsImports
System.Web.UI.HtmlControls Imports System.IODim strDirectory As String strDirectory = System.Web.HttpContext.Current.Session("FtpFolder") uploadFile.SaveAs(String.Format("{0}{1}", strDirectory, uploadFile.FileName))
This doesn't work.
Mike