Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8638225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:40:37+00:00 2026-06-12T10:40:37+00:00

So, on my site, I use a couple different SSL cerficates. One for the

  • 0

So, on my site, I use a couple different SSL cerficates. One for the root domain “illution.dk” and one for my subdomain “ci.illution.dk”. Trouble is, when I fire a post request using HttpPost, and I request a URL like “https://ci.illution.dk/login/device”, it just throws an error message saying:

10-04 18:35:13.100: W/System.err(1680): javax.net.ssl.SSLException: hostname in certificate didn't match: <ci.illution.dk> != <www.illution.dk> OR <www.illution.dk> OR <illution.dk>

I think this means that it is downloading the certificate of illution.dk, and then seeing that it does not support ci.illution.dk. However, everything is fine when I load up the browser and browse to “https://ci.illution.dk&#8221;. My Android code is as follows:

HttpClient httpclient = new DefaultHttpClient();
        //appContext.getString(R.string.base_url)
        HttpPost httppost = new HttpPost("https://ci.illution.dk/login/device");

        try {
            // Add your data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("username", params[0]));
            nameValuePairs.add(new BasicNameValuePair("password", params[1]));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            httppost.addHeader("Content-Type", "application/x-www-form-urlencoded");

            // Execute HTTP Post Request
            HttpResponse response = httpclient.execute(httppost);
            return response;
        } catch (ClientProtocolException e) {
            Log.d("ComputerInfo", "Error while loggin in: ClientProtocolException");
            return null;
        } catch (IOException e) {
            Log.d("ComputerInfo", "Error while loggin in: IOException");
            e.printStackTrace();
            return null;
        } catch (Exception e) {
            Log.d("ComputerInfo", "Error while loggin in");
            e.printStackTrace();
            return null;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:40:38+00:00Added an answer on June 12, 2026 at 10:40 am

    Ok, it seems that it is an error with HttpPost, because if I use the code linked here it just works. I have modified the code to suit my specific needs, but here is my code: (Just in case the link goes down)

        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    
        StrictMode.setThreadPolicy(policy);
    
    //do this wherever you are wanting to POST
        URL url;
        HttpURLConnection conn;
    
        try{
        //if you are using https, make sure to import java.net.HttpsURLConnection
        url=new URL("https://ci.illution.dk/login/device");
    
        //you need to encode ONLY the values of the parameters
        String param="username=" + URLEncoder.encode("usernametest","UTF-8")+
        "&password="+URLEncoder.encode("passwordtest","UTF-8");
    
        conn=(HttpURLConnection)url.openConnection();
        //set the output to true, indicating you are outputting(uploading) POST data
        conn.setDoOutput(true);
        //once you set the output to true, you don't really need to set the request method to post, but I'm doing it anyway
        conn.setRequestMethod("POST");
    
        //Android documentation suggested that you set the length of the data you are sending to the server, BUT
        // do NOT specify this length in the header by using conn.setRequestProperty("Content-Length", length);
        //use this instead.
        conn.setFixedLengthStreamingMode(param.getBytes().length);
        conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        //send the POST out
        PrintWriter out = new PrintWriter(conn.getOutputStream());
        out.print(param);
        out.close();
    
        //build the string to store the response text from the server
        String response= "";
    
        //start listening to the stream
        Scanner inStream = new Scanner(conn.getInputStream());
    
        //process the stream and store it in StringBuilder
        while(inStream.hasNextLine())
            response+=(inStream.nextLine());
    
            Log.d("Test", response);
        }
    
        //catch some error
        catch(MalformedURLException ex){
        Toast.makeText(MainActivity.this, ex.toString(), 1 ).show();
    
        }
        // and some more
        catch(IOException ex){
    
        Toast.makeText(MainActivity.this, ex.toString(), 1 ).show();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example to get the favicon of a site I can use http://www.google.com/s2/favicons?domain= and
I'm using an API from a different site that returns a couple of 'pricepoint
Our SharePoint site has a couple of broad groups that use it. In essence
I'd like to offer my app users a couple of different skins to use
The Django admin site makes use of a really cool widget: How can I
On my site I use require.js to manage my code, on the main page
I'm switching over our site to use Asynchronous Google Analytics, and I'm curious about
I'm trying to convert my existing site to use WCF to communicate with my
In general, If I have a choice when developing a web site to use
I have a site that makes use of GET variables to determine what to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.