Create File in memory...

  • Thread starter Thread starter Nicholas Then
  • Start date Start date
N

Nicholas Then

I am writing an ASP.NET application and I have a class
that I have written to create a vCard...it just returns a
string with all the necessarry info... Anyway...is there
a way that I can create a text file in memory and then
stream it to the browser so that I do not have to create
the file and save it to a temporary location?
 
I have a similar issue with Images on web pages, since the rendered <img>
tag must point to a valid URL, and can't be filled with an IMAGE object.

If you have a page whose purpose in life is to create your stream, you can
take the string (or stream) and save it to the pages OutputStream
(MyStream.Save(Response.OutputStream))
Then that page will be the source page for the vCard.

hth

Kevin
 
Nicholas Then said:
I am writing an ASP.NET application and I have a class
that I have written to create a vCard...it just returns a
string with all the necessarry info... Anyway...is there
a way that I can create a text file in memory and then
stream it to the browser so that I do not have to create
the file and save it to a temporary location?

System.IO.MemoryStream

Arnaud
MVP - VC
 
Hi!
Chris wrote: "Could someone post the manual edit (or another solution)?"

I've also encountered the situation mention above. It did - of course -
happen after I had fooled around, and done some counter-intuitive things to
code that was originally bound to source control.

I have the manual fix for the problem:

I got the following error message:
"The solution appears to be under source control, but its binding
information cannot be found. It is possible that the MSSCCPRJ.SCC file or
another item that holds the source control settings for the solution, has
been deleted. Because it is not possible to recover this missing information
automatically, the projects whose bindings are missing will be treated as
not under source control."
.... but when I selected the "Change Source Control" menu option in Visual
Studio .NET 2003, the solution did not seem to be bound to Source Control at
all.

As requested above: These were the steps that I followed to succesfully rid
my solution of _all_ of it's references to Source Control (and the annoying
error message) in a manual way:
1. Delete all the "<projectName>.vbproj.vspscc" project MetaData files. C#
developers should look for the files named "<projectName>.csproj.vspscc"
2. Delete all the "vssver.scc" files (if any).
3. Delete the "<solutionName>.vssscc" file.
4. Open the "<solution>.sln" file in a text editor (such as notepad.exe) and
remove all the information between the following two "Section start/end
identifiers" (including the identifiers):
GlobalSection(SourceCodeControl)
....
EndGlobalSection
5. Open each "<projectName>.vbproj"file (or "<projectName>.csproj"-file
for c# developers) in a notepad.exe style editor. Remove all entries similar
to the ones below.
SccProjectName = ...
SccLocalPath = ...
SccAuxPath = ...
SccProvider = ...

It's quite likely that you don't have to do all of the above (maybe just
#4.& #5.) in order to rid yourself of the annoying pop-up. Go through all
the steps and you're guaranteed to be liberated from source control.

sincerely,
Simen Sandelien
http://konsulent.sandelien.no
 
Hi Nicholas

A sample with an image in a dataset (vb)
If you are using C# is the only difference is the declarations
\\\
Dim arr() As Byte = CType(Ds.tables(0).Rows(0)("Photo"), Byte())
Dim ms As New IO.MemoryStream(arr)
Dim im As Image = Image.FromStream(ms)
///

I hope this helps?

Cor
 
Back
Top