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 6321639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:11:11+00:00 2026-05-24T16:11:11+00:00

From some of the action methods I want to return a result that will

  • 0

From some of the action methods I want to return a result that will force current page to refresh.

I wrote this to acquire such result:

 public class RefreshResult : ActionResult {

        public override void ExecuteResult(ControllerContext context) {
            Uri referrer = context.HttpContext.Request.UrlReferrer;
            if(referrer == null || string.IsNullOrEmpty(referrer.AbsoluteUri)) {
                return;
            }
            context.HttpContext.Response.Redirect(referrer.AbsoluteUri);
        }
    } 

In my action methods I simply return new RefreshResult. It works, but I am curious of the possible limitations of such approach. I am not intrested in giving customers an option to access action methods returning such results directly, so I think that I always will be able to refresh current page in such a way. Am I right?

I found this (and couple of other questions) on stackoverflow:
ActionResult return to page that called it

But I am more intrested in possible limitations of such approach, not in a “how to”.

Thanx in advance

  • 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-05-24T16:11:11+00:00Added an answer on May 24, 2026 at 4:11 pm

    I am not sure what do you mean by “result that will force current page to refresh”. If you are executing action on server, you are already “refreshing” the page.

    If what you want is some kind of post-redirect-get pattern in order to “land” on original page by GET action again, it is very easy – just implement your custom ActionResult as derived from RedirectToRouteResult (used by RedirectToAction() method on Controller), and supply it with current route values.

    Your approach based on referrer is not entirely bad, but keep in mind that referrer is header sent by browser and can by optional in some clients (disabled in browser etc.), while current route values are always available to you.

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

Sidebar

Related Questions

I have an action 'approval' that renders a view which displays some content from
I have a spring action that I am rendering some json from the controller,
Im a getting errors from some code developed in Java that want to use
I want to run some code from an ASP.NET MVC controller action in a
I want to encapsulate delegate methods, which will be invoked later on. This delegate
i want to send some data from Action Helper to view Partial and i
I want to start several threads, retrive data from net, perform some actions with
So I just switched from some network solutions hosting running some php files that
I've seen from some sources that although you can make an exe or mac
I read from some books that Phusion Passenger is the answer to easy Ruby

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.