Port to Visual Studio

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,270
Latest member
TopCryptoTwitterChannels_

Latest Threads

Top