That's all, I have a controller that saved the published file (see code below). It took about 20-30 minutes. But after saving the file, I found that RedirectToAction is not working. IE status bar is displayed:
Waiting for http:
BTW, my session state is stored in SQL Server. And the timeout is 300 minutes. I'm not sure if this is a problem if I have a relationship with the IIS 7 application pool application pool, which I already wrote about here . Although he did not redirect the action, I found that the session still exists. File and record were saved successfully. The only problem is not redirection. please help me .thanks.
[HttpPost] [AcceptButton("Upload")] public ActionResult Upload(UploadPackageModel model) { //after about 20-30 min for 160MB file-upload, runs here. DeployLogModel tempLog = null; try { if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { var file = Request.Files[0]; var fileName = Path.GetFileName(file.FileName); string sUploadFullPath = string.Empty; model.ID = Guid.NewGuid();//PK id of Uploaded Package string sUploadFileName = model.ID + Path.GetExtension(file.FileName); model.CreatedBy = DataHelp.LoginAdministrator.ID.ToString(); model.LastUpdatedBy = DataHelp.LoginAdministrator.ID.ToString(); model.PackageSize = Request.Files[0].ContentLength; model.CreatedDate = DateTime.UtcNow; model.LastUpdatedDate = DateTime.UtcNow; model.PackageName = fileName; string rootPath = AppDomain.CurrentDomain.BaseDirectory + "\\" + "DeployPackages\\"; sUploadFullPath = Path.Combine(rootPath, sUploadFileName); model.PackagePath = sUploadFullPath; if (!Directory.Exists(rootPath)) Directory.CreateDirectory(rootPath); file.SaveAs(sUploadFullPath);//Save the uploaded package. model.SavePackInfoIntoDB(model);//Save record to DB } } catch (Exception ex) { Log.Write("-Upload-Package-failed-:\r\n" + ex.Message + "\r\n" + ex.StackTrace); } return RedirectToAction("Index");//does not work. }
File and record were saved successfully. Only problem: it was not redirected.
Update:
Web.config httpRuntime:
<httpRuntime executionTimeout="14400" maxRequestLength="716800" />
Edited to add index action code:
public ActionResult Index(int? page) { var db = DbContextHelper.CreateInstance();
Edited to add Fiddler trace information
result protocol Host Url 200 http test.cloudapp.net /package/upload 200 http test.cloudapp.net /package/index
I see the contents of the html response in the script for /package/index , but the browser just freezes on the same page ( /package/upload ).
I was wondering if there is a way to modify the windows.location.href file using js code. My idea is to successfully complete the download action. then output some kind of script to the client, for example response.write script on the classic asp.net page. js will change window.location.href to redirect to /package/index . Is there a way to do this in ASP.NET MVC4?
source share