M
MichaelR
I have an ASP.NET application that I coded with a text editor and command
line compiler. I'm trying to port it to Visual Studio for the IDE tools and
debugger, but am having a lot of problem with code that works in my original
app and not in Visual Studio.
For example, my application has a component dll with some utility functions
in it. One of the functions is accessing the application configuration
which is a serializable object stored in a app.dat file on disk.
The routine to de-serialize the file and create the object looks like this:
Dim objFileStream As FileStream
Dim bFileOpen As Boolean
Dim objBinaryFormatter As BinaryFormatter
Try
objHttpContext = System.Web.HttpContext.Current
bFileOpen = False
objFileStream = New
FileStream(objHttpContext.Server.MapPath("/makeReady/Customers/mrConfig.dat"
), FileMode.Open)
objBinaryFormatter = New BinaryFormatter
objAppConfig = CType(objBinaryFormatter.Deserialize(objFileStream),
AppConfig)
objHttpContext.Application("AppConfig") = objAppConfig
This works in my original app, but in Visual Studio the
'formatter.Deserialize' line throws an invalid cast exception.
Any suggestions?
Thanks.
line compiler. I'm trying to port it to Visual Studio for the IDE tools and
debugger, but am having a lot of problem with code that works in my original
app and not in Visual Studio.
For example, my application has a component dll with some utility functions
in it. One of the functions is accessing the application configuration
which is a serializable object stored in a app.dat file on disk.
The routine to de-serialize the file and create the object looks like this:
Dim objFileStream As FileStream
Dim bFileOpen As Boolean
Dim objBinaryFormatter As BinaryFormatter
Try
objHttpContext = System.Web.HttpContext.Current
bFileOpen = False
objFileStream = New
FileStream(objHttpContext.Server.MapPath("/makeReady/Customers/mrConfig.dat"
), FileMode.Open)
objBinaryFormatter = New BinaryFormatter
objAppConfig = CType(objBinaryFormatter.Deserialize(objFileStream),
AppConfig)
objHttpContext.Application("AppConfig") = objAppConfig
This works in my original app, but in Visual Studio the
'formatter.Deserialize' line throws an invalid cast exception.
Any suggestions?
Thanks.