0

I have been looking for more information on how to login to an aspx based website from a C# NET application, but everything I find is based on creating aspx login systems in C# instead. I would like the user to be able to login to an .aspx site, having nothing to do with any actual ASP code in my project. Can anyone provide more information on this?

6
  • are you using WebClient on your app and you want to download something from the web app ? Commented Feb 26, 2011 at 9:29
  • 1
    Can you re-word your question a bit please. Your title says ASP but the first sentence is confusing. Commented Feb 26, 2011 at 9:29
  • 2
    What kind of authentication is your ASP.NET application using? Windows Authentication, ASP.NET authentication (such as ASP.NET Membership) etc. Each authentication protocol is different. Please also explain what you mean by C#.NET application. Is that a Windows/ WPF application? Do you need to run it from the same network as your ASP.NET application or is it over the Internet? Commented Feb 26, 2011 at 9:33
  • Sorry about that. I am not sure what kind of Authentication it is using, I will check. It is a Windows Application I am developing, and no, it is on a seperate network so it is over the internet. The site I want to login to is my.xfactorservers.com/Templates/Default/login.aspx Commented Feb 26, 2011 at 9:45
  • Do you want to visually render that site in your Windows client (using System.Windows.Forms.WebBrowser for example) or do you want to perform background, "invisible" requests (using System.Net.HttpWebRequest for instance)? Commented Feb 26, 2011 at 10:06

1 Answer 1

3

In most basic cases, you will have to:

  1. Identify which POST parameters are used to represent the login and the password
  2. Make a POST request to the login page providing these parameters
  3. Get all cookies from the response and ensure to provide them during your subsequent requests

Check the following page for an example of implementation: Fetching ASP.NET authenticated page with HTTPWebRequest

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.