Filestream Reference

With this snipplet of code.  What do i need to reference in C# to get this to work? Or what am i doing wrong?
i get the following errors:
1.  System.EventArgs' does not contain a definition for 'Message'
2.  A local variable named 'e' cannot be declared in this scope because it would give a different meaning to 'e', which is already used in a 'parent or current' scope to denote something else
3. Cannot create an instance of the abstract class or interface 'System.IO.Stream'

I have the following already referenced:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;


int fileid = Convert.ToInt32(DataGrid1.SelectedItem.Cells[1].Text);
com.solutions.webservices.Crypt ws = new com.solutions.webservices.Crypt();

byte[] test = ws.DecryptStoredFile(pm.sessionKey,fileid);

string FileName = Path.GetTempFileName();
FileStream File_Stream = new FileStream(FileName, FileMode.Append, FileAccess.Write);
StreamWriter FileWriter = new Stream(File_Stream);
try
{
      FileWriter.BaseStream.Seek(0, SeekOrigin.End);
      FileWriter.WriteLine(test);
}
catch(Exception e)
{
      Response.Write(e.Message.ToString());
}
finally
{
      FileWriter.Close();
}
GoldenJagAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GoldenJagAuthor Commented:
Sorry, i wasnt very clear.

error number 1 comes from this snipplet of code:  Response.Write(e.Message.ToString());

error number 2 comes from this snipplet: catch(Exception e)

error number 3 comes from this snipplet: StreamWriter FileWriter = new Stream(File_Stream);   // new is underlined  

Error number 3 is my main concern.
0
Carl TawnSystems and Integration DeveloperCommented:
If your code is part of an event handler then e.Message is causing a conflict with "EventArgs e" in the event arguments. Try changing to:

     catch (Exception ex)
     {
         Response.Write(ex.Message.ToString());
     }
0
Carl TawnSystems and Integration DeveloperCommented:
Error 3 comes from you trying to create a new Stream (which is an abstract class).

Try:

    StreamWriter FileWriter = new StreamWriter(File_Stream);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

GoldenJagAuthor Commented:
Thanks carl tawn!! that got rid of errors 1 and 2.  Any clue on what to do for error number 3?
0
Carl TawnSystems and Integration DeveloperCommented:
See previous post :o)
0
GoldenJagAuthor Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.