c# - RestClient Execuete response "fatalerror" while Authenticate Storefront URL -
i authenticate storefront url below code getting fatalerror please help
code :
public static authcredential authenticate(string storefronturl, string username, string password, string domain)
{ var isssl = storefronturl.tolower().indexof("https:", stringcomparison.ordinal) != -1; var csrftoken = guid.newguid().tostring(); var aspnetsessionid = guid.newguid().tostring(); var request = new restrequest("/postcredentialsauth/login", method.post); request.addheader("x-citrix-isusinghttps", isssl ? "yes" : "no"); request.addheader("content-type", "application/x-www-form-urlencoded"); request.addheader("csrf-token", csrftoken); request.addcookie("csrtoken", csrftoken); request.addcookie("asp.net_sessionid", aspnetsessionid); var authenticationbody = string.format("username={0}\\{1}&password={2}", domain, username, password); request.addparameter("application/x-www-form-urlencoded", authenticationbody, parametertype.requestbody); var client = new restclient(storefronturl); //set cookie container client.cookiecontainer = new system.net.cookiecontainer(); var response = client.execute(request); if (response.responsestatus == responsestatus.error) { throw new exception(string.format("error: {0}", response.errormessage)); }
error in response :
authenticationstatus : result = fail, logmessage = fatalerror
but status code ok.
please help.
Comments
Post a Comment