• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

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);
      FileWriter.BaseStream.Seek(0, SeekOrigin.End);
catch(Exception e)
  • 3
  • 3
1 Solution
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.
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)
Carl TawnSystems and Integration DeveloperCommented:
Error 3 comes from you trying to create a new Stream (which is an abstract class).


    StreamWriter FileWriter = new StreamWriter(File_Stream);
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

GoldenJagAuthor Commented:
Thanks carl tawn!! that got rid of errors 1 and 2.  Any clue on what to do for error number 3?
Carl TawnSystems and Integration DeveloperCommented:
See previous post :o)
GoldenJagAuthor Commented:

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now