Ik heb een webserver gemaakt in C#
nu het probleem is dat als ik een .swf file open dat het niet afspeelt in de browser maar het begint te downloaden als MIME type gebruik ik voor swf : application/ x-shockwave-flash
om de file door te sturen convert ik de file naar een byte[]
Code :
Daarna stuur ik deze door via TCPClient :
nu het probleem is dat als ik een .swf file open dat het niet afspeelt in de browser maar het begint te downloaden als MIME type gebruik ik voor swf : application/ x-shockwave-flash
om de file door te sturen convert ik de file naar een byte[]
Code :
Code:
private byte[] FileToByteArray(string _FileName)
{
byte[] _Buffer = null;
try
{
System.IO.FileStream _FileStream = new System.IO.FileStream(_FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.IO.BinaryReader _BinaryReader = new System.IO.BinaryReader(_FileStream);
long _TotalBytes = new System.IO.FileInfo(_FileName).Length;
_Buffer = _BinaryReader.ReadBytes((Int32)_TotalBytes);
_FileStream.Close();
_FileStream.Dispose();
_BinaryReader.Close();
}
catch (Exception _Exception)
{
Console.WriteLine("Exception caught in process: {0}", _Exception.ToString());
}
return _Buffer;
}
Daarna stuur ik deze door via TCPClient :
Code:
ClientData.Write(Response.header(), 0, Response.header().Length);
ClientData.Write(Response.content(), 0, Response.content().Length);