SHARE
TWEET

DL3 Controller

CryptoJones Sep 26th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   public ActionResult Index(string filename)
  2.         {
  3.             string DL3 = "https://reinkestorageprod.blob.core.windows.net/dl3/{0}";
  4.  
  5.             var blob_url = string.Format(DL3, filename);
  6.             var fs = TransferFile(blob_url);
  7.             if (fs != null)
  8.             {
  9.                 return fs;
  10.             }
  11.  
  12.             return new HttpNotFoundResult();
  13.         }
  14.  
  15.         private ActionResult TransferFile(string dest)
  16.         {
  17.             try
  18.             {
  19.                 WebRequest request = WebRequest.Create(dest);
  20.                 WebResponse response = request.GetResponse();
  21.                 Stream stream = response.GetResponseStream();
  22.                 if (dest == "https://reinkestorageprod.blob.core.windows.net/dl3/wyserver.wys")
  23.                 {
  24.                     return new FileStreamResult(stream, "application/octet-stream");
  25.                 }
  26.                 FileStreamResult fs = new FileStreamResult(stream, FTTLib.FTT.GetMimeType(dest));
  27.                 return fs;
  28.             }
  29.             catch (Exception e)
  30.             {
  31.                 Trace.TraceError("ERROR: {0}", e.Message);
  32.             }
  33.  
  34.             return null;
  35.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top