示例#1
0
        static void Main(string[] args)

        {
            if (args.Length < 3)

            {
                Console.WriteLine("Usage: getConfig <NS IP> username password");

                return;
            }

            string serverip = args[0];

            string username = args[1];

            string password = args[2];

            try {
                Console.WriteLine("\nConnecting to server " + serverip + " ............\n");

                client = new ClientService(serverip);



                client.CookieContainer = new System.Net.CookieContainer();

                simpleResult result = client.login(username, password);

                Console.WriteLine("login : "******"enablensfeature	REWRITE : "+ result.message);



                result = client.addrewriteaction("rewrite_act1", actionrewritetypeEnum.DELETE, "HTTP.RES.HEADER(\"Server\").VALUE(0)", null, yesnoEnum.VALNOTSET);

                Console.WriteLine("addrewriteaction	rewrite_act1 : " + result.message);



                result = client.addrewritepolicy("rewrite_pol1", "HTTP.RES.HEADER(\"Server\").CONTAINS(\"IIS\")", "rewrite_act1", null);

                Console.WriteLine("addrewritepolicy	rewrite_pol1 : " + result.message);



                result = client.bindrewriteglobal_policy("rewrite_pol1", 1, "END", rwglobalbindpointEnum.VALNOTSET, false, policylabelinvoketypeEnum.VALNOTSET, null);

                Console.WriteLine("bindrewriteglobal_policy	rewrite_pol1 : " + result.message);



                result = client.logout();

                Console.WriteLine("logout : " + result.message);
            }

            catch (Exception ex) {
                Console.WriteLine("Exception: " + ex.ToString());
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            if ( args.Length < 3)

            {

                Console.WriteLine("Usage: getConfig <NS IP> username password");

                return;

            }

            string serverip = args[0];

            string username = args[1];

            string password = args[2];

            try {

              			Console.WriteLine("\nConnecting to server "+serverip+" ............\n");

                client = new ClientService(serverip);

                client.CookieContainer = new System.Net.CookieContainer();

                simpleResult result = client.login(username,password) ;

                Console.WriteLine("login : "******"enablensfeature	REWRITE : " + result.message);

                result = client.addrewriteaction("rewrite_act1",actionrewritetypeEnum.DELETE,"HTTP.RES.HEADER(\"Server\").VALUE(0)",null,yesnoEnum.VALNOTSET);

                Console.WriteLine("addrewriteaction	rewrite_act1 : " + result.message);

                result = client.addrewritepolicy("rewrite_pol1","HTTP.RES.HEADER(\"Server\").CONTAINS(\"IIS\")","rewrite_act1",null);

                Console.WriteLine("addrewritepolicy	rewrite_pol1 : " + result.message);

                result = client.bindrewriteglobal_policy("rewrite_pol1",1,"END",rwglobalbindpointEnum.VALNOTSET,false,policylabelinvoketypeEnum.VALNOTSET,null);

                Console.WriteLine("bindrewriteglobal_policy	rewrite_pol1 : " + result.message);

                result = client.logout();

                Console.WriteLine("logout : " + result.message);

            }

            catch (Exception ex) {

                  Console.WriteLine( "Exception: "+ex.ToString());

            }
        }