Automatically log into a web-site c# Programmatically

Asked

Viewed 1,347 times

1

The company where I work has 3 websites both with login and password

I would like to know something in c# NET or Javascript that is from a redirect link logged in.

1 Step: Access Site 1 www.site.com.br
2 Step: Login Site 1
3 Step: Within Site 1 (Siteb Sitec) by clicking on anyone redirect logged in - and do not need to log in again.

The goal is to centralize in 1 single site, and within it be the 3 sites.

I managed to do this in windows form following this video https://www.youtube.com/watch?v=baA2tph_yTo

navigate("http://www.seusite.com.br/login.aspx");
webBrowser1.Document.GetElementById("login_login").InnerText = textBox1.Text.ToString();
webBrowser1.Document.GetElementById("login_pass").InnerText = textBox2.Text.ToString();
webBrowser1.Document.GetElementById("login_sent").InvokeMember("click");

But on the Web I didn’t find much help.

  • We need some more information: are the 3 sites sub-domains of the same domain? Are they on the same server? How is the session maintained in each of them (cookie or other method)? Do you have access to data sources/bunch? It is possible to do, but it can be quite complicated, according to the answers to these questions.

  • 1

    You can implement SSO (Single Sign On) on websites or Openauth so that they all share the authentication token, but this requires a lot of implementation

  • You are using authentication with AD (Active Directory)?

  • I believe you have a home-brewed logon system, in this case since you want to share the logon between different domains, then one output would be to implement a Webapi (new domain) to perform the logon, this could return a token that would log in automatically to the current system.

  • @Viníciusgobboa.deOliveira These are different domains on another server... the 3 are in cookies ... I do not have access to the source code... because it is the staff of our headquarters in the USA who do the maintenance ... But I have administrator access that is possible to login to the 3 sites. For example : a vendor X uses the same username and password on the 3 different sites I have set up a sqlserver database... where I store the vendors' username and password

  • @Viníciusgobboa.deOliveira In the main website of the company in Brazil I have access to the source code and we were the ones who developed... in it I want to create a new login The user will log stores in cookie for example and when clicking on one of the 3 site ...it enter the user and password and then gives a Submit all automatically

  • @Juniorpedro Using an Ajax call to each of the domains by sending login information should be possible. You need to configure the server to allow Ajax calls from different sources, and configure the correctly generated cookie (it should be used not only for simple HTTP requests). In PHP and JS are all simple tasks to perform, but it may not be possible since you do not have access to the source code. I can give more details, if the "solution" (gambiarra) interest. But the correct thing would be to do this session exchange in the backend.

  • @Wineusgobboa.deOliveira Depending on what I have to do in the third party source code I can request to do, I believe it would be ideal in the backend but in the future it will unify everything.. I don’t see problems in front.. As in the video I posted, I could post this solution in ajax for me to analyze how it works ?. Thanks.

  • @Tobymosque How would this webAPI ?

  • @Caputo I set up a test using SSO to validate a token but since I don’t have access to the 1 source code of the sites I can’t make any suggestions ?

  • Is the login function published? If it is, you can login to the 3 site via API

  • @Caputo is yes, but it’s dark for me on the API

  • And they can’t support you or provide API documentation?

Show 8 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.