C#: Best way to programmatically log into a secure web form and "surf" several pages using ASPSESSIONID cookie

Posted on 2012-09-13
Last Modified: 2012-09-27
What is the easiest/best way to authenticate using a simple POST using HTTPS and keep the session alive from page to page?

Some say System.Net.WebClient and some say HttpWebRequest/HttpWebResponse/CookieContainer.

Is there a built-in class that I can instantiate and call GET() and POST() methods on successively and it manages all host session details?
Question by:ZuZuPetals
    1 Comment
    LVL 16

    Accepted Solution

    Best way is to use HttpWebRequest and HttpWebResponse because this is better configurable to your needs than webclient. When your receive the response, read the cookies you have gotten and memberize these so you can create a new request using the existing cookies(sessions). There is the CookieContainer property for this to read this info.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now