×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    50

    User and Password

    Hi gurus,

    Code:
    private StringBuffer LoadFile(String url, String fileName) throws IOException {
            StreamConnection c = null;
            InputStream s = null;
            StringBuffer sb = new StringBuffer();
            String err=null;
            try {
                c = (StreamConnection)Connector.open(url + fileName);
                try{
                    s = c.openInputStream();
                    String[] strAux=null;
                    int ch, i=0;
                    while((ch = s.read()) != -1) {
                        sb.append((char) ch);
                    }
                    String strSb=null;
                    strSb=sb.toString();
                    
                }catch (ConnectionNotFoundException ce){
                    err = ce.getMessage();
                    sb = null;
                    Alert alertM = new Alert("Info: (LoadFile)", err, null, AlertType.INFO);
                    Display.getDisplay(this).setCurrent(alertM);
                }catch (IOException e){
                    err = e.getMessage();
                    sb = null;
                    Alert alertM = new Alert("Info: (LoadFile)", err, null, AlertType.INFO);
                    Display.getDisplay(this).setCurrent(alertM);
                }
            }catch (Exception ce){
                err = ce.getMessage();
                sb = null;
    
            } finally {
                if(s != null) {
                    s.close();
                }
                if(c != null) {
                    c.close();
                }
                return sb;
            }
        }
    I have this function to read some file from a url. It works good exept at one case... If the URL that I'm try accessing have login authenthication this stop's at line s = c.openInputStream();.

    The thing is that when I try to access to this file in the same URL from normally process by phone (not in my app) this request user and password. At my app this do not happen. Can anyone explain me why and what can I do to automatically request user/password only when it's necessary?

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,699

    Re: User and Password

    hi,
    here is an article which describes implementation of basic authorization:
    http://www2.sys-con.com/ITSG/virtual...vey/index.html
    hth,
    regards,
    Peter

Similar Threads

  1. Proxy server (user name and password) in Update Manager
    By zielinski in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2010-08-28, 06:28
  2. User Password Settings - Need help ...
    By cbrueckner in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-01-03, 04:22
  3. Tools Downloading Error,geting ask for user and password
    By dr_saf in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2006-01-13, 01:28
  4. Problem in setting Password
    By SachinKumar in forum Symbian
    Replies: 0
    Last Post: 2005-06-21, 14:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •