Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:56:55+00:00 2026-06-13T16:56:55+00:00

All, I have a controller which saved the posted file(Please review below code). It

  • 0

All, I have a controller which saved the posted file(Please review below code). It took about 20-30 min to finish it. But I found after saving the file, the RedirectToAction didn’t work. the IE status bar shown :

Waiting for http://......./index.

BTW, My session state is stored in SQL Server. And timeout is 300 Mins. I am not sure this problem if has relationship with IIS 7 app pool idle time which I post here before.
Although it didn’t redirect to the action ,I found the session still exists.
The file and the record were saved successfully .Only problem is It didn’t redirect.
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.
}

The file and the record were saved successfully .Only problem is It didn’t redirect.

Update:

Web.config httpRuntime setting is:

<httpRuntime executionTimeout="14400" maxRequestLength="716800" />

Edited to add Index action code:

public ActionResult Index(int? page)
{
        var db = DbContextHelper.CreateInstance();

        //Find all uploaded packages.
        var packages = db.DeployPackages.OrderByDescending(x => x.CreatedDate).Select(x => new PackageModel
             {
                 PackageId = x.ID,
                 UploadedBy = x.CreatedBy,
                 Description = x.Description,
                 PackageName = x.PackageName,
                 PackageSize = x.PackageSize,
                 PackagePath = x.PackagePath,
                 UploadTime = x.CreatedDate,
                 VersionName = x.VersionName
             }).ToList();

        int pageSize = ConfigHelper.BigPageSizeNum;
        int pageNumber = (page ?? 1);
        return View(packages.ToPagedList(pageNumber, pageSize));
    }

Edited to add Fiddler trace info

result protocol Host                 Url          

200    http     test.cloudapp.net    /package/upload
200    http     test.cloudapp.net    /package/index

I can see the response html content in the fiddler for /package/index,but the browser just freeze on the same page(/package/upload) .

I wondered if there is a way to change the windows.location.href with js code ,My idea is when finished upload action successfully. then output to client some script like response.write script in classical asp.net page . the js change windows.location.href to redirect to /package/index. Is there any way to make it in ASP.NET MVC4?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:56:56+00:00Added an answer on June 13, 2026 at 4:56 pm

    Using Content(sResultScript, "text/html") to output javascript to redirect index url. IE8 shown a failed page , chrome and Firefox is OK .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my controller: @cats = DirCat.all And this in a
I have this simple code in my user_controller.rb file #listing all users def index
I have a controller Contracts and 3 GET methods: All, Focus, which contains grid,
i have several controllers which will all be using common functionality. So i have
My site is open to all but i have a controller with some method
I have a variable @products = Product.all defined inside new method in a controller.
I want to have a route that looks something like: www.abc.com/companyName/Controller/Action/Id However, all the
Evening all, I just had a quick question about SQL average queries. I have
I have a tab bar controller with different view controllers all using the same
I have a view controller which contains a field for user to enter date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.