title: Why does download pdf using browser require login while using postman does not?
body: <p>I tried to test my APIs (Direct Download Pdf API) using postman (Send &amp; Download) and <strong>all went well and the file was downloaded successfully, no need to set login information</strong>. But when i tried to <strong>use mozilla browser</strong>, it's tell me <strong>login required? why?</strong></p>
  
  <p><strong>Here is my response header using postman:</strong><br>
  <br><a href="https://i.stack.imgur.com/TdiSC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TdiSC.png" alt="enter image description here"></a></p>
  
  <p><strong>And here when i try using browser, show idm downloader ask username password:</strong> <br>
  <br><a href="https://i.stack.imgur.com/KvGlQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KvGlQ.png" alt="enter image description here"></a></p>
  
  <p><br><a href="https://i.stack.imgur.com/LGS0W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LGS0W.png" alt="enter image description here"></a></p>
  
  <p><br>Here is my code</p>
  
  <pre><code>            [Authorize]                
              [HttpGet]
              public IHttpActionResult GetDownloadPdf(string date)
              {
                  HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
                  ResponseData responseData = new ResponseData();
  
                  try
                  {
                      _logDataBLL.SaveRequestLogRecord(RequestType.GET, MethodBase.GetCurrentMethod().Name);
  
                      MA_MS_Agent objdata = new MA_MS_Agent();
  
                      //Update - Checking current user still active 
                      var identity = User.Identity as ClaimsIdentity;
                      if (LoginBLL.isStillActive(identity) == false)
                      {
                          dynamic Reject = new ExpandoObject();
                          Reject.Message = "Authorization has been denied for this request.";
  
                          return Content(HttpStatusCode.Unauthorized, Reject);
                      }
  
  
                      date = "01" + date.Substring(2);
                      string filename = "1000007"+ "_" + date + ".pdf";
  
                      ByteArrayContent pdfByte;
  
                      MA_MS_ApplicationParameter Selected_Parameter = AddReferralBLL.getAppParameterByCode("APPP025");
                      string param_value = Selected_Parameter.ApplicationParameter_Value;
  
                      string pdfFilePath = param_value + filename;
                      byte[] bytes = null;
  
                      if (File.Exists(pdfFilePath))
                      {
                         bytes = System.IO.File.ReadAllBytes(pdfFilePath);
                      }
                      else
                      {
                         return BadRequest();
                      }
  
  
                      using (var m = new MemoryStream())
                      {
                         pdfByte = new ByteArrayContent(bytes);
                      }
  
  
                      if (pdfByte == null)
                      {
                          responseData = _responseDataBLL.GenerateResponseData(HttpStatusCode.NoContent);
                          responseData.status = true;
                          return Ok(responseData);
                      }
  
                      response.Content = pdfByte;
                      response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
                      response.Content.Headers.ContentDisposition.FileName = filename;
                      response.Content.Headers.ContentType = new MediaTypeHeaderValue("Application/pdf");
                      //response.Headers.Add("MyHeader", "MyHeaderValue");
                      //response.Content = new StringContent(JsonConvert.SerializeObject(result), Encoding.UTF8, "application/json");
                      return ResponseMessage(response);
                  }
                  catch (Exception ex)
                  {
                      string error = ex.Message;
  
                      if (ex.InnerException != null)
                          error += " =&gt; " + ex.InnerException.Message;
  
                      responseData = _responseDataBLL.GenerateResponseData(HttpStatusCode.InternalServerError, error);
  
                      _logDataBLL.SaveResponseLogRecord(JsonConvert.SerializeObject(responseData));
  
                      return Content(HttpStatusCode.InternalServerError, responseData);
                  }
  
              }
  </code></pre>