I have a SaveFileDialog
to download file.
It works fine until I host the website on IIS. Then it starts to open a debugger.
My code:
string downloadUrl = string.Empty;
var newThread = new Thread((ThreadStart)(() =>
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.ShowNewFolderButton = true;
if (fbd.ShowDialog() == DialogResult.Cancel)
return;
downloadUrl = fbd.SelectedPath;
}));
newThread.SetApartmentState(ApartmentState.STA);
newThread.Start();
newThread.Join();