Click here to Skip to main content
15,910,411 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I like create a one click login ,
so here i ll store my user credentials and site url
if click that site means it needs to get auto login
so my concept my app should provide login credentials to that site and it needs get auto login
for example if i save www.facebook.com ,ar@gmail.com and ******* means if i click the link means it needs to auto login to my facebook account without any api
Posted

1 solution

I found this code in the given site.
Please check this. Auto Login



C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace baltracker
{
   public partial class Form1 : Form
   {
      string url = "http://www.filmai.in";
      string username = "login";
      string password = "pass";
      public Form1()
      {
         InitializeComponent();
         Login();
      }

private void Login()
{
	 WebBrowser b = new WebBrowser();
	 b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
	 b.Navigate(url);
}

private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
	 WebBrowser b = sender as WebBrowser;
	 b.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
	 b.DocumentCompleted += new           WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted2);

string postData = string.Format("login_name=0}&login_password=1}&image.x=0&image.y=0&login=submit", username, password);
	 ASCIIEncoding enc = new ASCIIEncoding();
    b.Navigate(url, "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n");
}

private void b_DocumentCompleted2(object sender, WebBrowserDocumentCompletedEventArgs e)
{
	 WebBrowser b = sender as WebBrowser;
	 string response = b.DocumentText;
         MessageBox.Show("baigta");
}

private void Form1_Load(object sender, EventArgs e)
{

}
   }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900