Ask a Question related to ASP.NET Web Services, Design and Development.
-
Thom Little #1
Temporary Flat Files
I have an ASP 3 application that I am converting to and improving with
ASP.NET. This application creates two temporary flat files and appends them
to an SMTP mail message that it then sends.
Can I use the Cache in ASP.NET for a similar purpose instead of writing to
and reading from disk on the server? Is there a better approach?
Is there an example or description that you can recommend?
--
-- Thom Little -- [url]www.tlanet.net[/url] -- Thom Little Associates, Ltd.
--
Thom Little Guest
-
Help! - ASP.NET cannot 'Temporary ASP NET Files'
Guys, Sorry if this has been covered and for the cross post(ish). I have tried suggestion I have come across (i.e. Adding myself to the... -
DB2 and Flat files
Hi, I'm new in DB2. Can anyone tell me whether there is any command in DB2 to batch update the contents of a flat file into a DB2 table. ... -
indexing flat files
Hi, I have a file (about 3-4 MB ) with about 20000 records in it. I need to create an index on a particular field (integer ) in each record. But... -
How to create .deb of flat files?
Hi All! I've got a handful of regular flat text files that I would like to make into a .deb but I'm not familiar with doing anything that doesn't... -
Temporary files
I was working on a 100+ MB file when comp restarted, have no idea why, lost almost 2 hours work, in temporary files folder there's a 1GB file which i... -
Manohar Kamath #2
Re: Temporary Flat Files
The following article contains code to create attachments, you could perhaps
modify it to use a stream instead.
[url]http://www.eggheadcafe.com/articles/20030316.asp[/url]
I am guessing there is code somewhere that writes these flat files. So,
instead of writing the files, pass the stream to the above code. Hope that
helps.
--
Manohar Kamath
Editor, .netWire
[url]www.dotnetwire.com[/url]
"Thom Little" <thom@tlanet.net> wrote in message
news:OYaSRgzIFHA.1860@TK2MSFTNGP15.phx.gbl...them> I have an ASP 3 application that I am converting to and improving with
> ASP.NET. This application creates two temporary flat files and appends> to an SMTP mail message that it then sends.
>
> Can I use the Cache in ASP.NET for a similar purpose instead of writing to
> and reading from disk on the server? Is there a better approach?
>
> Is there an example or description that you can recommend?
>
> --
> -- Thom Little -- [url]www.tlanet.net[/url] -- Thom Little Associates, Ltd.
> --
>
>
>
Manohar Kamath Guest
-
Thom Little #3
Re: Temporary Flat Files
That is a very interesting article and probably helpful for solving a larger
problem that I have.
I currently have the revised application written and tested to use Smtp. It
is invoked with a form from any HTTP page. The remaining issue is to create
and attach two files. I am looking for an example that allows me to attach
"files" that are not physically resident on disk. Perhaps this is a
capability provided by the Cache?
The reason is that writing them to disk makes it necessary to have a
dedicated folder (temp) that has permissions adjusted for ASP.NET access.
This makes it cumbersome to setup when moved to a server under some else's
control.
--
-- Thom Little -- [url]www.tlanet.net[/url] -- Thom Little Associates, Ltd.
--
"Manohar Kamath" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:%232IY1lzIFHA.2844@TK2MSFTNGP10.phx.gbl...> The following article contains code to create attachments, you could
> perhaps
> modify it to use a stream instead.
>
> [url]http://www.eggheadcafe.com/articles/20030316.asp[/url]
>
> I am guessing there is code somewhere that writes these flat files. So,
> instead of writing the files, pass the stream to the above code. Hope that
> helps.
>
> --
> Manohar Kamath
> Editor, .netWire
> [url]www.dotnetwire.com[/url]
Thom Little Guest
-
[MSFT] #4
Re: Temporary Flat Files
Hello Thom,
The object in ASP.NET cache cannot be used as actual file for amail
attachment. I think Manohar's suggestion is the right way to resolve the
problem. You can take a look at following code in the sample he recommended:
MailAttachment a = o as MailAttachment;
byte[] binaryData;
if(a!=null)
{
FileInfo f = new FileInfo(a.Filename);
sb.Append("--unique-boundary-1\r\n");
sb.Append("Content-Type: application/octet-stream; file=" + f.Name +
"\r\n");
sb.Append("Content-Transfer-Encoding: base64\r\n");
sb.Append("Content-Disposition: attachment; filename=" + f.Name + "\r\n");
sb.Append("\r\n");
FileStream fs = f.OpenRead();
binaryData = new Byte[fs.Length];
long bytesRead = fs.Read(binaryData, 0, (int)fs.Length);
fs.Close();
string base64String = System.Convert.ToBase64String(binaryData,
0,binaryData.Length);
...
Above code add an attachment to the mail and data is in the byte array.
Based on the sample, you can load your data in a byte array or stream, and
then add to the mail.
Luke
[MSFT] Guest



Reply With Quote

