Tags down


How to RedirectToAction in ASP.NET MVC without losing request data

By : seathief
Date : July 28 2020, 09:00 AM
Hope that helps The solution is to use the TempData property to store the desired Request components.
For instance:
code :
public ActionResult Send()
    TempData["form"] = Request.Form;
    return this.RedirectToAction(a => a.Form());
public ActionResult Form()
    /* Declare viewData etc. */

    if (TempData["form"] != null)
        /* Cast TempData["form"] to 
        and use it */

    return View("Form", viewData);

Share : facebook icon twitter icon

asp.net mvc: make RedirectToAction(string, object) into RedirectToAction<Controller>(x => x.Detail(id))

By : user1699772
Date : March 29 2020, 07:55 AM

I can't get redirecttoaction to work in asp.net mvc after receiving data from flash

By : geran
Date : March 29 2020, 07:55 AM
Does that help Redirects are the job of the client (browser). You're simply telling the browser that you would like it to redirect. I don't know anything about flash but note that these redirects don't work with Ajax requests either. I know that's not a full answer but may send you in the right direction while you're waiting on someone with some flash experience.

Is it possible to RedirectToAction passing data without using parameters in an ASP.NET MVC project?

By : Jan Holicek
Date : March 29 2020, 07:55 AM
should help you out You can't send data with a RedirectAction. That's because you're doing a 301 redirection and that goes back to the client.
So better use TempData
code :
public class CreatePersonData
     public string name {get; set;}
     public string address {get; set;}
CreatePersonData person=new CreatePersonData();

return RedirectToAction("CreatePerson", "Home")
public ActionResult CreatePerson()
    CreatePersonData person=new CreatePersonData()
    var loadPerson= TempData["person"];
    person = loadPerson;
    return View(person);
//PEEK value so it is not deleted at the end of the request
var loadPerson= TempData.Peek("person");
//get value marking it from deletion
var loadPerson = TempData["person"];
//later on decide to keep it
return RedirectToAction("CreatePerson", "Home", new { ID = User.ID });
public ActionResult CreatePerson(int ID)
    CreatePersonData person=new CreatePersonData();
    var user=(from u in tbl_user select u where u.ID=ID);
    return View(person);
public class CreatePersonData
     public string Id{get; set;}
     public string name {get; set;}
     public string address {get; set;}

public ActionResult CreatePerson(int ID)
    CreatePersonData person=new CreatePersonData();
    var loadPerson=(CreatePersonData)TempData.Peek("person"); //cast the object from TempData
    if(loadPerson!=null && loadPerson.Id==ID)
         var user=(from u in tbl_user select u where u.ID=ID);
    return View(person);

ASP .NET Core MVC: What happens to a request on RedirectToAction

By : Palmetto Wood Shop
Date : March 29 2020, 07:55 AM
around this issue As mentioned, RedirecToAction will cause the browser to make a new request, and when that new request comes in, it will create a totally new HttpContext. As mentioned, To pass data between the two requests, you can use the query string, session or cookies. But there is another option to consider.

ASP.NET MVC Temp Data and RedirectToAction in web form

By : Tim C
Date : March 29 2020, 07:55 AM
I wish this help you You are right to be concerned, a RedirectToAction sends the client a 302 message containing a url of the redirected resource. This is then the clients responsibilty to create a new request to the redirected resource. There is no guarantee this resource will be served by the original server. The fact that the request is pulled immediately from TempData makes no difference to this approach, at some point it is going to error.
You need to have some means of managing sessions. You could configure HTTP session affinity so that requests served from a server will always return to the originating server.
Related Posts Related Posts :
  • Access properties of a virtual class in partial class
  • How to post a message to google chat room using C#? (**Error**: Request had insufficient authentication scopes)
  • How to get all USA timezone IDs using nodatime
  • How to pass object of unknown type to function
  • Is it OK to inherit an empty Interface?
  • If I implement IEquatable<T>, will I lose the option to compare by reference?
  • Authorize with both ASP.NET core MVC/Razor site AND a WebAPI
  • If Condition Simplification
  • ASP Net Core Web API: Client side GroupBy is not supported
  • C# I have a DLL file and I need to make a class that inherits from a class that's in the DLL file?
  • How can I cause a derived method to be called during an inherited base constructor?
  • How to subtract between two integer List in C#?
  • Using SerialPort variable through MainWindow
  • The most efficient way (performance/time wise) to find a highest value in a List with continuously changing values?
  • How to Deserialize Json string to Type without creating class
  • How to enforce this one-to-many constraint in C#?
  • MVC: Unable to update one of my model's properties
  • Task.WhenAll with LINQ select
  • I am creating the controller in asp dot net core but Giving Error
  • How to define a constraint in Ortools to set a limit of distinct values
  • How to check for Carriage Return of each element end in string array and add if not exists?
  • Multithreading | Thread was being aborted
  • Why would you use TransactionScope for Read-Only Database Calls in NET C#?
  • How to branch code based on class data type
  • Is there a way to linking two data values, simpler than Dictionary?
  • How to display a file in a folder without showing physical path?
  • Are binary tree nodes passed by reference?
  • Convert float to decimal, wrong value
  • Can someone tell me why (return DayName;) causes an ERROR cause it's an unassigned local variable?
  • Prohibit access to the private variable
  • c# How do I correctly compile code for distribution?
  • C# Passing a reference to a generic method to another method
  • Pass property name as parameter
  • Why converting empty value to datetime2 is throwing conversion error in SQL?
  • Is it possible to have a method that I can call one time with (ref int x) and other times with (value int x) --- (ByValu
  • Why parent task finishes before his children tasks?
  • Ternary Operator behaviour in C#
  • How can I make a c# application outside of visual studio?
  • Why constructors if curl braces
  • Why is MemoryStream not disposed?
  • What is the C# equivalent of Swift's URL struct in Xamarin.iOS?
  • C# importing class as *
  • Find node clicked under context menu
  • Casting: (NewType) vs. Object as NewType
  • Mapping Stream data to data structures in C#
  • Datatable vs Dataset
  • What's the best way to implement BDD/TDD in .NET 2.0?
  • How can I change the background of a masterpage from the code behind of a content page?
  • Developing for ASP.NET-MVC without Visual Studio
  • Most Efficient Way to Test Object Type
  • Locating Text within image
  • Wiggling the mouse
  • .NET Unit Testing packages?
  • Reducing duplicate error handling code in C#?
  • Hiding inherited members
  • How to check for file lock?
  • Asynchronous multi-direction server-client communication over the same open socket?
  • ViewState invalid only in Safari
  • How do I delete a file which is locked by another process in C#?
  • Displaying Flash content in a C# WinForms application
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org