CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2010
    Posts
    20

    Get into page that requires password

    Hi everybody,
    I have a little question.
    I'm working on a program that should work with a site, but in order to get to the page I need to enter username and password.
    doe's someone can tell me how should I do that thing?
    I know the address of the page, the one the requires the password, but I dont kmow how to get to the next page (the one after that with password) all I need its the source of the page.
    if someone have any suggestion it can be very helpfull.
    thank you all.

  2. #2
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Get into page that requires password

    You appear to want advice on how to gain unauthorized access to a website. This is against the acceptable use policy for the forum (link) and you won't find any help with that here.

    If that is not the case, please clarify.
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    Aug 2010
    Posts
    20

    Re: Get into page that requires password

    It may be that I don't explain myself clearly enough, I want the source code of a web page, but its our website, its very clear that I dont take a source of another website.
    we are working in a company, you may ask yourself if its our website, what is the purpose of the source? if we have the site code, the answer is the we work on a project that requires the source code of the site.
    thank you for the note.

  4. #4
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Get into page that requires password

    Ah okay. So what you mean is that you want to programatically obtain the HTML to a page (that you are authorized to access) which is protected by a password on your local intranet? Assuming you're logging in using some sort of web form that is placing a session cookie, you should do something like this, probably: (n.b.: I've never done this before)

    What you probably need to do is generate a POST the login credentials just like the form would (see, for example: http://geekswithblogs.net/rakker/arc.../21/76044.aspx).

    However, you should modify this to store cookies in a CookieContainer like in: http://stackoverflow.com/questions/5...ttpwebresponse

    Then use the same CookierContainer to sent a request to get the desired page.

    ---

    Alternatively, if it's using basic authentication there is built in support for that: http://blog.kowalczyk.info/article/F...ttpWebReq.html

    Does that help?
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #5
    Join Date
    Aug 2010
    Posts
    20

    Re: Get into page that requires password

    I'm really sorry but I didn't get it...
    are you know or have a code sample (that works)?
    I think that it can be the best for me...

  6. #6
    Join Date
    Jul 2011
    Posts
    19

    Re: Get into page that requires password

    I've never done this in C so I might not help much but I will try.
    You need to look at the source of the log in page, find the name of the username and password variables, which is often just as simple as "username" and "password"
    Set those variables to whatever name/password you are using then post them to whatever page handles the input and it should return the source of the next page.

  7. #7
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Get into page that requires password

    I won't have time to write a bunch of code, but will try to point out some tutorials if possible. If you can give some more information, I might be able to help you more effectively. Can you be more specific about what you are seeing when you visit the page manually? Does the login page look like a normal webpage that happens to have a username and password field on it or does it pop up a dialog that looks more like this screenshot? (Or something different? A screenshot might be helpful.)
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured