how to avoid the authentication process of the login control if i'm aware of the login cridentials?

180 Views Asked by At

I developed one web site. And called the web site through windows form application with the help of web browser control. I used login control from asp.net in the web site for login process.

I want to avoid the authentication process of login control when web site is called from the windows forms application.

how to do this?

2

There are 2 best solutions below

1
Lefsler On

You can send some encrypted key, like an api key that google/facebook uses. This key can match with your login/salt or anythin you like

0
Rob On

You can use the WebBrowser.Navigate(string, string, byte[], string) method to make your request, passing in the credentials either as POST data, or as supplementary HTTP headers. For example (with a supplementary header):

var headers = "X-Credentials: CREDENTIALS_HERE";

browserControl.Navigate("http://www.myserver.com/Page.aspx", "", null, headers);

NOTE: I'm not sure if you need to pass in null or an emptry byte[] for the 3rd parameter.

Your page can then read the data from the additional header(s) and use that to authenticate the request, rather than requiring your user go through the login process.