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

  • SEARCH
  • Home
  • 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 8934657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:50:24+00:00 2026-06-15T09:50:24+00:00

I know this question has been addressed many times on SO, but for the

  • 0

I know this question has been addressed many times on SO, but for the life of me I can’t get it to work, none of the solutions proposed are fixing the problem for me. So here is the scenario, I have a main form where the user enters some data, and uploads a picture. The upload is happening via ajax (using valum’s file uploader), so the file is posted to the controller as soon as it’s uploaded, I then resize the picture server side and return a thumbnail which is contained inside a partial view. The partial view is on the same view that the user enters their details in. This all works perfectly fine the first time, and the file is sent to the server and a thumbnail is generated and returned to the partial view, but this is not happening the second time. Here is the Main form, containing the section where the partial view is to be returned(ThumbnailDiv):

@using (Html.BeginForm("Upload","Home", FormMethod.Post)) 
{
    @Html.ValidationSummary(true)
    <fieldset >
      //Some input fields
      //Uploader
            <div id="file-uploader">
                <noscript>
                    <p>Please enable JavaScript to use file uploader.</p>
                </noscript>
            </div>
    </fieldset>
}
        <input type="submit" value="View thumbnail" id="btnGetThumbnail" />
        <div id="ThumbnailDiv" style="float: right;width: 500px; height: 500px;">
        </div>


<script type="text/javascript">
    $(document).ready(function () {
        $("#btnGetThumbnail").click(function (e) {
            e.preventDefault();

            var myDiv = $('#ThumbnailDiv');
            $.ajax({
                url: '@Url.Action("GetThumbnail", "Home")',
                type: 'GET',
                cache: false,
                success: function (result) {
                    myDiv.html(result);
                }
            });

        });
    });

</script>

Here is the GetThumbnail action on the Home controller:

    [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
    public ActionResult GetThumbnail()
    {
        ViewBag.TheTime = System.DateTime.Now.ToString();
        return PartialView("~/Views/Home/ThumbnailFinal.cshtml",mvm);
    }

I’m passing the current time to the partial view to check whether the request are being updated, which they are, however I can’t seem to be able to tell the view to re render the thumbnail image. Here is the Partial View (ThumbnailFinal.cshmtl):

@ViewBag.TheTime

<img src="@Url.Action("GenerateThumbnail")" alt="" />

The Problem:

The image is not being refreshed and is failing to call the GenerateThumbnail action the second time. The time is being updated so I know the GetThumbnail action is called, however the image is not recalling the GenerateThumbnail action the second time. How would I resolve this? Is there any better way to render an image from an action inside a partial view?

Any help would be greatly appreciated.

  • 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-15T09:50:25+00:00Added an answer on June 15, 2026 at 9:50 am

    It looks like the image is cached on the client. You could bust the cache by appending a random query string parameter:

    <img src="@Url.Action("GenerateThumbnail", new { seed = DateTime.UtcNow.Ticks })" alt="" />
    

    or disable the cache on the GenerateThumbnail controller action by decorating it with the [OutputCache] attribute, the same way you did with your GetThumbnail action.

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

Sidebar

Related Questions

I know this question has been asked many times, but my problem is a
I know this question has been asked and answered many times. But almost all
I know this has been addressed many times, but i just cant seem to
I know this question has been asked many times before, but I haven't found
I know this question has been rised quite a lot of times, but then
I know this question has been asked before, but non of the solutions solve
I know this question has been asked a zillion times, but I still feel
I know the tagging stuff has been mentioned many times, but I can't seem
I know this question has been asked many times and the answer is always
I know this question has been asked, but I can't find more than one

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.