WebService, cross-platform, standardized, and other advantages over a period of time are not mentioned, but there are also many disadvantages.
Especially for security issues, as long as you know that the WebService address can be accessed through the Asp.net Web Service, and the methods are explicit, it is not safe.
Today, we have added the Security Authentication Mechanism to WebService, so that we have a level-1 verification.
For example:
Create a WebService
Public class WebService: system. web. services. webService {Public Key key = new key (); Public WebService () {// if you are using the designed component, uncomment the following line // initializecomponent ();} [webmethod] [soapheader ("key")] Public String helloworld () {If (key. isvalid () Return "Hello World"; else return "";}}
Create an operation key that inherits the soapheader
Public class key: soapheader {Public Key () {// todo: add the constructor logic here // security key public string key {Get; set ;} public bool isvalid () {return isvalid (key);} public bool isvalid (string key) {try {string keyconfig = "123"; if (Key = keyconfig) {return true;} else {return false ;}} catch {return false ;}}}
Call:
WebService. webService webs = new WebService. webService (); WebService. key key = new WebService. key (); key. key = "123"; webs. gnet_keyvalue = key; show. innerhtml = webs. helloworld ();
If the key is incorrect, null is returned; otherwise, helloworld is returned.