ASP.NET Web Service Using Form Authentication from a Windows Application

I have an ASP.NET web service that I can access through a Windows program, but now I want to protect the web service. I can protect the web service using forms authentication. How to access a secure web service from a Windows forms application?

+3
source share
3 answers

Although this is not the right approach, it is theoretically possible to use form authentication the way you describe. This can be done either:

  • WebRequest -. , , . ,
  • cookie FormsAuhentication . , , , .
  • - , -. cookie HTTP-, (2).

, - , .

Microsoft Windows, SSL- - ASP.NET. . HTTP - ASP.NET MSDN.

WCF, , SOAP WCF.

- - . , , , .

+1

, . - cookie, WinForms cookie ( - , ).

, , NetworkCredential, . ClientCredentials .NET 4.0.

var ss = new MySecureWebService.MyServiceSoapClient();
ss.ClientCredentials.UserName.UserName = "abc";
ss.ClientCredentials.UserName.Password = "123";
string asmxReturn = ss.HelloWorld(); //exception returned here

- - html.

  • -, . WinForms, , -.

, - , , / .dll.

0

Source: https://habr.com/ru/post/1739701/


All Articles