c# - Remove Cookies in Visual Studio WebTest -
i want remove cookies of application in visual studio webtest how can ? 1 of webtestrequest
webtestrequest request = new webtestrequest( dataprovider.data.onlineserver + "/auth/login" ); request.method = "post"; request.expectedresponseurl = (dataprovider.data.onlineserver + "/"); request.headers.add( new webtestrequestheader( "referer", dataprovider.data.onlineserver + "/auth/login" ) ); formposthttpbody request2body = new formposthttpbody(); request2body.formpostparameters.add("loginhash", loginhash); request2body.formpostparameters.add("username", username); request2body.formpostparameters.add("password", password); request2body.formpostparameters.add("otp", ""); request.body = request2body; return request;
according this page can clear cookies creating new cookiecontainer
, assigning web test context. overwriting unwanted (container of) cookies new empty container.
in coded web test code be:
this.context.cookiecontainer = new system.net.cookiecontainer();
in plugin code be:
e.webtest.context.cookiecontainer = new system.net.cookiecontainer();
Comments
Post a Comment