Results 1 to 7 of 7
  1. #1
    mukesh450 is offline Member
    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    Default How to login to a secure website

    Hi There,

    I am trying to create a code which can login to a user/password secure website using Java.

    The problem which I am facing here is that my login URL gets redirected to some other URL as soon as I enter the login credentials and I am not able to figure out how can I keep the Cookies or Headers or anything constant so that I can verify that the script is able to login successfully.

    I am able to get the source of my login page but I am not able to redirect to the page post login.

    Can anyone please suggest me a way to create this script.

    Thanks in advance,
    Mukesh.

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: How to login to a secure website

    You can place a flag or attribute in the HttpSession which indicates that the user is login or nor. Everytime a user tried to access to a protected resource check whether this attribute is valid in his session. If valid grant the user access to the resource otherwise ask the user to login first.

  3. #3
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: How to login to a secure website

    Quote Originally Posted by mukesh450 View Post
    Hi There,

    I am trying to create a code which can login to a user/password secure website using Java.

    The problem which I am facing here is that my login URL gets redirected to some other URL as soon as I enter the login credentials and I am not able to figure out how can I keep the Cookies or Headers or anything constant so that I can verify that the script is able to login successfully.

    I am able to get the source of my login page but I am not able to redirect to the page post login.

    Can anyone please suggest me a way to create this script.

    Thanks in advance,
    Mukesh.
    Are you talking about a Java client accessing a website, or are you talking about a web app you have written?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    mukesh450 is offline Member
    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    Default Re: How to login to a secure website

    Thanks wsaryada for that example URL is there any way we can do it using HttpURLConnection ??

    Tolls i am trying to create a java code that can try login to a web site and check whether login is successful or not.

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: How to login to a secure website

    Have you told your connection to follow redirects?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    mukesh450 is offline Member
    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    Default Re: How to login to a secure website

    I am not sure how to do that kind of new for creating such scripts

    Will be very helpful if you can suggest anything.

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: How to login to a secure website

    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Help with login to a website!
    By OllyHal in forum Android
    Replies: 0
    Last Post: 02-07-2013, 09:32 PM
  2. Replies: 1
    Last Post: 03-27-2011, 12:28 PM
  3. how to login to website to get access using java?
    By theChameleon in forum Advanced Java
    Replies: 0
    Last Post: 10-29-2010, 06:20 PM
  4. Trying to login to a website then grab another page
    By DaveTheAve in forum New To Java
    Replies: 6
    Last Post: 04-14-2010, 09:44 PM
  5. servlet secure login
    By simo_mon in forum Java Servlet
    Replies: 0
    Last Post: 11-07-2009, 02:04 AM

Posting Permissions

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