public HttpResponseMessage OpenFileForEservice([FromBody] OpenDocumentParams data) { return(new HttpResponseMessage() { Content = new StringContent(MobileDataBase.DownloadOrgReqDocForEservice(data), System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage OpenFile([FromBody] OpenDocumentParams data) { string login = ConfigurationManager.AppSettings["UploadAccessUserId"].ToString(); string domain = ConfigurationManager.AppSettings["UploadAccessDomainName"].ToString(); string password = Crypt.DecryptData(ConfigurationManager.AppSettings["UploadAccessPassword"].ToString()); string tokenId = (data == null || data.tokenId == null) ? "" : data.tokenId; string mUserid = (data == null || data.mUserid == null) ? "" : data.mUserid; string DocumentId = (data == null || data.DocumentId == null) ? "" : data.DocumentId; //tokenId = Convert.ToString(System.Web.HttpContext.Current.Request.Form["tokenId"]); //mUserid = Convert.ToString(System.Web.HttpContext.Current.Request.Form["mUserid"]); //DocumentId = Convert.ToString(System.Web.HttpContext.Current.Request.Form["DocumentId"]); MobileDataBase.Result rslt = MobileDataBase.GetValidUserDetails(tokenId, mUserid); rslt.Data = null; try { if (rslt.status == "0") { string SuffixPath = MobileDataBase.GetDocPath(DocumentId, mUserid); string sPath = ""; sPath = Path.Combine(ServerUploadFolder, SuffixPath); if (ConfigurationManager.AppSettings["UploadAccessImpersinationRequired"].ToString() == "Y") { using (UserImpersonation user = new UserImpersonation(login, domain, password)) { if (user.ImpersonateValidUser()) { return(DownLoadFile(sPath)); } } } else { return(DownLoadFile(sPath)); } } } catch (Exception ex) { throw ex; } return(this.Request.CreateResponse(HttpStatusCode.NotFound, "File not found.")); }