HttpListener loading Java Applet in html page

Discussion in 'ASP .Net' started by Reg, Sep 4, 2007.

  1. Reg

    Reg Guest

    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,
     
    Reg, Sep 4, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cmFqYW1hbmlja2Ft?=

    HttpListener in VS2005

    =?Utf-8?B?cmFqYW1hbmlja2Ft?=, Apr 1, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,134
    =?Utf-8?B?cmFqYW1hbmlja2Ft?=
    Apr 4, 2005
  2. Archana
    Replies:
    1
    Views:
    1,386
    Andrew Thompson
    Oct 25, 2004
  3. =?Utf-8?B?c3RvbmVyZWRfc2R1?=

    Bugs on HttpListener

    =?Utf-8?B?c3RvbmVyZWRfc2R1?=, Sep 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    812
    =?Utf-8?B?c3RvbmVyZWRfc2R1?=
    Sep 10, 2006
  4. Enrico Sabbadin
    Replies:
    3
    Views:
    938
    Enrico Sabbadin
    Jul 18, 2007
  5. unitm
    Replies:
    0
    Views:
    644
    unitm
    Aug 22, 2007
Loading...

Share This Page