string fromdate = string.Format("{0:yyyy-MM-dd}", DateTime.Parse(FromDate, new CultureInfo("hi-IN"))); string todate = string.Format("{0:yyyy-MM-dd}", DateTime.Parse(ToDate, new CultureInfo("hi-IN"))); string Cthotelencoding = Uri.EscapeUriString(RoomTypeName).Replace("%20", "+").Replace("/", "%2F"); string sessioncookie = "login=true;" + cookiestring; string[] crsf = cookiestring.Split('=', ';'); var postdata = "csrfmiddlewaretoken=" + crsf[1] + "&roomtypecode=%7B%22roomtypecode%22%3A%22" + RoomTypeCode + "%22%2C%22roomtypename%22%3A%22" + Cthotelencoding + "%22%7D&fromDate=" + fromdate + "&toDate=" + todate + "&checkall=" + DaysList + "inventory_action=default_inventory&available=16&minnonights=&cutoff_filter=hours&cutoff="; string responseJson = string.Empty; using (WebClient client = new WebClient()) { client.Headers[HttpRequestHeader.Accept] = "*/*"; client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded; charset=UTF-8"; client.Headers[HttpRequestHeader.ContentLength] = (postdata.Length).ToString(); client.Headers[HttpRequestHeader.Cookie] = sessioncookie; client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"; byte[] response = client.UploadData("https://in.****.com/extranet/inventory/submitroominventory/", Encoding.UTF8.GetBytes(postdata));//======>(ERROR SPOT) responseJson = Encoding.UTF8.GetString(response); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)