locked
going over pages in web site with login RRS feed

  • Question

  • i have web site in php, which i want to parse with c# (only 1 page).

    the thing is that i have first to login, and then go to another page and parse it.

    i looked at this code

    http://msdn.microsoft.com/en-us/library/debx8sh9(v=vs.80).aspx

    but how can i use the session when going between the pages?

    thanks :)

    • Moved by Anne Jing Tuesday, July 15, 2014 2:07 AM
    Saturday, July 5, 2014 4:08 PM

Answers

  • Hi,

    You should go to ASP.NET forum to get more professional help!

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Proposed as answer by Just Karl Monday, August 4, 2014 9:53 PM
    • Marked as answer by Just Karl Thursday, August 7, 2014 8:35 PM
    Tuesday, July 15, 2014 2:07 AM

All replies

  • Use the page_load event. Check the session.

    For example if the session contains a user name, so if the user did not log in, it would be empty.

    So check the session:

    if (Session["UserName"] != null
    {
         // it means that the user logged in
    }

     

    Noam B.


    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...

    • Proposed as answer by Noam B Sunday, July 6, 2014 10:14 AM
    Sunday, July 6, 2014 10:14 AM
  • i don't think you understand the question.

    i don't have control over the php site.

    i want to login to thewebsite using WebRequest class, and after login to go to another page

    on that site.

    Sunday, July 6, 2014 5:19 PM

  • but how can i use the session when going between the pages?


    Once you have successfully logged in with the WebRequest class, you should simply be able to submit the new page as a url to the CreateHttp() member function.

    The hard part is how to log in. Is this a forms-based web site? Or is it using browser-based authentication? Personally, I find the easiest way of solving this by using the built-in debugger in Internet Explorer, or Firebug in Firefox to catch the Http request when you log in using the browser, and then reproducing the exact same Http request through the program code.

    Sunday, July 6, 2014 6:26 PM
  • if i take the line

    WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx ");

    how i can not move to another page with

    request ?

    Monday, July 7, 2014 2:32 PM
  • Hi,

    You should go to ASP.NET forum to get more professional help!

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Proposed as answer by Just Karl Monday, August 4, 2014 9:53 PM
    • Marked as answer by Just Karl Thursday, August 7, 2014 8:35 PM
    Tuesday, July 15, 2014 2:07 AM