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 8896425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:02:49+00:00 2026-06-15T00:02:49+00:00

i have a problem logging in to a website made in asp… Here is

  • 0

i have a problem logging in to a website made in asp…
Here is the code i am using:

public class MainActivity extends Activity {
Button bottone;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        bottone = (Button) findViewById(R.id.button1);
        if (android.os.Build.VERSION.SDK_INT > 9) {
            StrictMode.ThreadPolicy policy = 
                    new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
            }
        bottone.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // starting new Async Task
                try {
                    login();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    public static void login() throws IOException
    {
        String loginurl = "https://www.blurum.it/Web/", user, pass;
        user = "tester55";
        pass = "provapassword321";

        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(loginurl);

        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
        nameValuePairs.add(new BasicNameValuePair("ctrl_LoginControl$loginView$c01$RPLogin$LoginView$Username", user));
        nameValuePairs.add(new BasicNameValuePair("ctrl_LoginControl$loginView$c01$RPLogin$LoginView$Password", pass));
        nameValuePairs.add(new BasicNameValuePair("remember", "on"));
        nameValuePairs.add(new BasicNameValuePair("ctrl_LoginControl$loginView$c01$RPLogin$LoginView$LoginButton", "Accedi"));



        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request 
        HttpResponse response = httpClient.execute(httpPost);
        Log.d("logggd", "response stat code " + response.getStatusLine().getStatusCode());

        if (response.getStatusLine().getStatusCode() < 400) {

            String cookie = response.getFirstHeader("Cookie")
                    .getValue();
            Log.d("logggdc", "cookie: " + cookie);

            // get the contacts page 
            HttpGet getContacts = new HttpGet("https://www.blurum.it/Web/default.aspx");
            getContacts.setHeader("Cookie", cookie);
            response = httpClient.execute(getContacts);

            InputStream ins = response.getEntity().getContent();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    ins));

            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                Log.d("logggd1", " " + inputLine);
            }

            in.close();
        } else {
                Log.d("logggd2", "Response error: "
                        + response.getStatusLine().getStatusCode());
            }
        }
    }

But my application crash, so i can’t find the error in the code… Here is the logcat:

    11-12 20:05:37.678: W/dalvikvm(1806): threadid=1: thread exiting with uncaught exception (group=0xb4177180)
11-12 20:05:37.688: E/AndroidRuntime(1806): FATAL EXCEPTION: main
11-12 20:05:37.688: E/AndroidRuntime(1806): java.lang.NullPointerException
11-12 20:05:37.688: E/AndroidRuntime(1806):     at com.example.testlogin.MainActivity.login(MainActivity.java:93)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at com.example.testlogin.MainActivity$1.onClick(MainActivity.java:53)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at android.view.View.performClick(View.java:3511)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at android.view.View$PerformClick.run(View.java:14105)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at android.os.Handler.handleCallback(Handler.java:605)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at android.os.Looper.loop(Looper.java:137)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at android.app.ActivityThread.main(ActivityThread.java:4424)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at java.lang.reflect.Method.invokeNative(Native Method)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at java.lang.reflect.Method.invoke(Method.java:511)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-12 20:05:37.688: E/AndroidRuntime(1806):     at dalvik.system.NativeStart.main(Native Method)
11-12 20:05:38.218: I/dalvikvm(1806): threadid=3: reacting to signal 3
11-12 20:05:38.228: I/dalvikvm(1806): Wrote stack traces to '/data/anr/traces.txt'

I extracted the posted data to the server in firefox with Tamper Data, here is a screen, the login i think is divided in 2 post, here are the screen:
https://i.stack.imgur.com/GZiZ0.png
https://i.stack.imgur.com/FKH3P.png

I am not sure if i have to send the first page or the second post data, can be this the error? thanks.

  • 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-15T00:02:50+00:00Added an answer on June 15, 2026 at 12:02 am

    It seems response.getFirstHeader("Cookie") is returning null.

    As per javadoc

    Returns the first header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the first element of getHeaders(String) is returned. If there is no matching header in the message null is returned

    Solution:

    Do a null check before calling getValue();

    Example:

    String cookie = null;
    if(response.getFirstHeader("Cookie") != null)
    {
    cookie = response.getFirstHeader("Cookie")
                        .getValue();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem logging onto a page and then using it with cURL.
I have a problem, I would like to build logging system which will be
I have problem with my query on C, I’m using the oci8 driver. This
So I have a website with multiple asp controls. When I press enter inside
I have deployed my asp.net 2.0 website on IIS, and I tested there by
We have a facebook website app for use as a public event kiosk. Many
I have a problem logging out redirecting a user on a logout page. I
hi i have problem with logging, first i registered user in database,this works ok!
I have a website built in PHP 4 with a framework made by hand
I have a main login for my client facing website configured with ASP.NET membership.

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.