R
Reg
I have a following code in HttpRequestListener's ProcessRequest method which
is a Windows
Console Application. I'm trying to read html page with browser (Opera) and
html file contains tags to include
Java Applet jar too,
for (int i = 0; i < numRequestsToBeHandled; i++)
{
HttpListenerResponse response = null;
try
{
// GetContext blocks while waiting for a request.
HttpListenerContext context = listener.GetContext();
// Create the response.
response = context.Response;
int pos = context.Request.Url.AbsoluteUri.LastIndexOf("/");
string file = context.Request.Url.AbsoluteUri.Substring(++pos);
byte[] buffer = new byte[32768];
// Reading html and Java Applet Jar file from file system
FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read);
int read = stream.Read(buffer, 0, buffer.Length);
stream.Close();
response.ContentLength64 = buffer.Length;
System.IO.Stream output = response.OutputStream;
output.Write(buffer, 0, buffer.Length);
output.Close();
Problem is that I get "Invalid Bytecode" error in Opera and IE shows
nothing.
Something missing, can anyone tell me what?
Cheers,
is a Windows
Console Application. I'm trying to read html page with browser (Opera) and
html file contains tags to include
Java Applet jar too,
for (int i = 0; i < numRequestsToBeHandled; i++)
{
HttpListenerResponse response = null;
try
{
// GetContext blocks while waiting for a request.
HttpListenerContext context = listener.GetContext();
// Create the response.
response = context.Response;
int pos = context.Request.Url.AbsoluteUri.LastIndexOf("/");
string file = context.Request.Url.AbsoluteUri.Substring(++pos);
byte[] buffer = new byte[32768];
// Reading html and Java Applet Jar file from file system
FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read);
int read = stream.Read(buffer, 0, buffer.Length);
stream.Close();
response.ContentLength64 = buffer.Length;
System.IO.Stream output = response.OutputStream;
output.Write(buffer, 0, buffer.Length);
output.Close();
Problem is that I get "Invalid Bytecode" error in Opera and IE shows
nothing.
Something missing, can anyone tell me what?
Cheers,