title: How can i use OpenFileDialog in C# mvc
body: <p>my Code is below</p>
  
  <pre><code> @Ajax.ActionLink("Choose File",
                              "chooseItemView",
                              new { },
                              new AjaxOptions
                              {
                                  UpdateTargetId = "replaceDiv",
                                  InsertionMode = InsertionMode.Replace,
                                  HttpMethod = "GET",
                                  //OnBegin = "startPreLoader",
                                  OnSuccess = "stopPreLoader",
                                  OnFailure = "stopPreLoader"
                              }, new
                              {
                                  @id=1,
                                  @type="file",
                                  @class="btn btn-primary offset-top-2",
                                  /*@id=item.GetHashCode().GetHashCode(),
                                   * onclick = "fileUploadFunction('" + item.GetHashCode().GetHashCode() + "')"*/
                                  onclick = "fileUploadFunction('" + 1 + "')"
                              })
  
  
  
   public ActionResult chooseItemView()
      {
          /*MessageBox.Show("Hi");*/
          OpenFileDialog openFileDialog=new OpenFileDialog();
          openFileDialog.Multiselect = false;
          openFileDialog.Filter = "txt files (*.txt)|*.txt| DOC files (*.doc)|*.doc";
          openFileDialog.ShowDialog();
          return PartialView("_UploadItemView",null);
      }
  </code></pre>
  
  <p>there is a exceoption when run this as below</p>
  
  <p>"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."</p>
  
  <p>so how can i solve this?</p>