Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / July 2004

Tip: Looking for answers? Try searching our database.

J# app and J# Browser Control behave differently

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry - 15 Jun 2004 23:10 GMT
I have an applet that sends data to a web server via the
query string of the url (HTTP GET).  When the query string
data contains a backslash (\) it is sent to the web server
differently depending on whether the code is running as a
browser control or a standalone application.  If the code
is running as a browser control all backslashes are
replaced with a fowardslash (/).  If the code is running
as a standalone application the backslashes are not
replaced.  Any ideas as to why the code is behaving
differently in the different environments?

Here is the code that I am using:

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.net.URL;
import java.net.*;
import java.io.*;

public class TestApplet extends Applet
{
  private void connect()
  {
     try
     {
        URL url = new URL
("http://localhost/test/printreq.asp?te\\st");
        URLConnection conn = url.openConnection();
        InputStream in = conn.getInputStream();
        in.close();
     }
     catch (Exception e)
     {
        this.add(new Label(e.getMessage()));
        e.printStackTrace();
     }
  }

  public void start()
  {
     connect();
  }
}
Thomas Alex [MSFT] - 09 Jul 2004 22:16 GMT
Hi Jerry,

This is not an expected behavior. The URL sent to the server should not
depend on whether the code is running in the context of a browser control or
an application. Can you tell us which version of the J# browser control you
are using (the 1.1b release has recently been made available - see
http://msdn.microsoft.com/vjsharp/downloads/browsercontrols/) and whether
you are still experiencing this problem?

thanks
Thomas Alex
Microsoft Visual J# Product Team

This posting is provided "AS IS" with no warranties, and confers no
rights.

>I have an applet that sends data to a web server via the
> query string of the url (HTTP GET).  When the query string
[quoted text clipped - 40 lines]
>   }
> }
Jerry - 16 Jul 2004 18:09 GMT
Thomas,

I am using version 1.1.  I retested the code and I am still having the problem.  I capture the network trace this time.

When run as a browser control the http request is formatted as follows:
GET /test.asp?te/st HTTP/1.1
Connection: Keep-Alive
Host: localhost:8080

When run as a stand alone app the http request is formatted as follows:
GET /test.asp?te\st HTTP/1.1
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
Host: localhost:8080
Connection: Keep-Alive

Again in both cases I used the following code:

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.net.URL;
import java.net.*;
import java.io.*;

public class AppletTest extends Applet
{
  private void connect()
  {
     this.add(new Label("test"));
     try
     {
        URL url = new URL("http://localhost:8080/test.asp?te\\st");
        URLConnection conn = url.openConnection();
        InputStream in = conn.getInputStream();
        in.close();
     }
     catch (Exception e)
     {
        this.add(new Label(e.getMessage()));
        e.printStackTrace();
     }
  }

  public void start()
  {
     connect();
  }
}

Here is the code for the stand alone app:

package AppletTestDriver;

/**
* Summary description for Class1.
*/
public class Class1
{
    public Class1()
    {
        //
        // TODO: Add Constructor Logic here
        //
    }

    /** @attribute System.STAThread() */
    public static void main(String[] args)
    {
        AppletTest applet = new AppletTest();
        applet.start();
    }
}

> Hi Jerry,
>
[quoted text clipped - 56 lines]
> >   }
> > }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.