Beispiel #1
0
 protected void SaveReponseStream(string key)
 {
     try
     {
         var response = ProgramStorageQueries.GetResponse(key).GetResponseStream();
         var stream   = Utilities.CopyAndClose(response);
         ProgramStorageQueries.SaveResponseStream(key, stream);
     }
     catch (Exception e)
     {
         CMD.ShowApplicationMessageToUser($"________message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }
Beispiel #2
0
 protected void ActivateResponse(string key)
 {
     try
     {
         var response = ProgramStorageQueries.GetResponse(key);
         if (response == null)
         {
             throw new Exception("response not valid");
         }
         ProgramStorageQueries.SetCurrentresponse(response);
     }
     catch (Exception e)
     {
         CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }
Beispiel #3
0
 /// <summary>
 /// diaplay response cookies
 /// </summary>
 /// <param name="key">response key</param>
 protected void ShowResponseCookieCollaction(string key)
 {
     try
     {
         var response   = ProgramStorageQueries.GetResponse(key);
         var collaction = response.Cookies;
         var count      = 0;
         foreach (System.Net.Cookie cookie in collaction)
         {
             CMD.ShowApplicationMessageToUser($"{count++} ) [clr" +
                                              $"name : {cookie.Name}] [value : {cookie.Value}] [path : {cookie.Path}] [domain : {cookie.Domain}]");
         }
     }
     catch (Exception e)
     {
         CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }
Beispiel #4
0
 /// <summary>
 /// fetch header value from response headers
 /// </summary>
 /// <param name="name">header name</param>
 /// <param name="key">response key</param>
 /// <param name="varCommand">The command to be processed to store the value</param>
 protected void FetchHeader(string name, string key, string varCommand)
 {
     try
     {
         var response = ProgramStorageQueries.GetResponse(key);
         foreach (var item in response.Headers)
         {
             if (item.ToString() == name)
             {
                 var val = response.Headers.GetValues(item.ToString())[0];
                 VariableAnalysis.ExecuteVariableCommand(varCommand, val);
             }
         }
     }
     catch (Exception e)
     {
         CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }
Beispiel #5
0
 /// <summary>
 /// display response properties
 /// </summary>
 /// <param name="key">response id paire with request id</param>
 /// <param name="targets">The properties that are Included are shown in yellow</param>
 /// <param name="all">If set to true all properties of http web request will be display</param>
 protected void ShowResponsePropeties(string key, string targets, string all)
 {
     try
     {
         var response         = ProgramStorageQueries.GetResponse(key);
         var targetsArray     = Utilities.GetArray(targets, Utilities.Mode_1);
         var targetProperties = all == "true" ? response.GetType().GetProperties() : (response.GetType().GetProperties().Where(p => Utilities.DefaultResponseShowableHeaders
                                                                                                                               .Any(str => str.Contains(p.Name))));
         var count = 1;
         foreach (var pi in targetProperties)
         {
             CMD.ShowApplicationMessageToUser(
                 $"{count++} ) {pi.Name} : {pi.GetValue(response, null)}"
                 , showType: targetsArray.Any(str => str.Contains(pi.Name)) && targets != null ?
                 ShowType.DataTarget : ShowType.INFO
                 );
         }
     }
     catch (Exception e)
     {
         CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }