title: How to prevent partial view direct access from url in asp.net mvc core?
body: <p>I want my partial view in asp.net mvc core to be only available through AJAX request. I am not able to decide the logic to prevent my partial view from being directly accessible from URL.</p>
  
  <p>One approach i used is </p>
  
  <pre><code>[HttpPost]
  public IActionResult Search(ListNSearchModel modelMain)
  { //....some logic...
   return PartialView();     
  }
  </code></pre>
  
  <p>This made my code only available through Post Request but i don't think this is correct way. </p>