Looking at the internet I saw some sites saying that when you have a Upload property on the page you can not give POST in it because it looping .
I have an application that creates / deletes folders and displays a POST message on the page so that it enters looping , and thus returning error .
MyquestionwouldbehowtogiveaPOSTonthepageinordertoupdateforminformationwithoutgoingintothislooping?
ExampleofUploadingFileUploadFileevent:
protectedvoidBtnCarregar_Click(objectsender,EventArgse){try{stringcaminho=ConfigurationManager.AppSettings["PastaRaiz"];
var source = Directory.GetDirectories(caminho).Select(c => new DirectoryInfo(c).Name).ToList();
if (ddlFolders.SelectedValue != null)
{
if (FileUpload1.HasFile)
{
string fileName = FileUpload1.FileName;
if (!Directory.Exists(caminho + ddlFolders.SelectedValue + "/" + fileName))
{
FileUpload1.PostedFile.SaveAs(caminho + ddlFolders.SelectedValue + "/" + fileName);
}
else
{
mensagens.ExibirMensagem("Mensagem", "Arquivo já existente no diretório.", false, this.Page, this.GetType());
}
}
}
mensagens.ExibirMensagem("Mensagem", "Arquivo carregado com sucesso.", false, this.Page, this.GetType());
}
catch (Exception ex)
{
throw ex;
}
}