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 :
  • Conversion textbox text to data type int impossible
  • C# how to copy a file held inside a variable and paste it to different location?
  • c# alphanumeric list sorting by checking if list item contains
  • C# Method has 1 parameter but is invoked with 2 arguments
  • How to check whether string contains specific string in c#
  • UPnP hole punching can't use external IP to access device on local subnet
  • Is there a way to use a conditional when declaring method variables?
  • c# interop Excel - disable or remove automatic page breaks
  • How can I read in these commands from a file using?
  • Pinch and rotate around a point using MRTK and Hololens 1
  • Enhance performance to paint image, is SIMD perhapse a solution?
  • Which one has better performance, data types .NET or alias name data types C#?
  • HttpClient GetAsync taking ~2 seconds
  • linq fastest where method
  • Why can I read more than 254 characters with Console.ReadLine when the docs suggest that I shouldn't be able to?
  • C# - Delayed execution for a collection of items
  • How to display images in a CollectionView from a Base64 string?
  • Convert class object to class index
  • c# identifier expected in controller
  • Subscribe to multiple Observables and gets notified on the same thread
  • how to create windows service using crud operations in c# asp.net
  • Iterating through list of values in a dictionary c#
  • How to Implement Expo.io Push Notifications Send Through C#
  • Gridview columns not being set to width I enter
  • Impersonate User with Forms Authorization
  • ASP.NET MVC Impersonate not working with Forms Authentication
  • Found a potential bug in Moq library while selecting a constructor
  • I want to show a list but page is empty
  • Can this kind of concurrency problem be solved with async/await?
  • Yield keyword giving unexpected values for IEnumerable
  • Many DLLs in System namespace are included when installing library via Nuget
  • C# - range for textbox inputs
  • the Console.ReadLine() Doesn't set the string as the user input
  • Get notified when a variable changed
  • How to list players in room in Photon?
  • Link compile-time created resources to a class library
  • How to quickly choose numbers and weights in such a way as to obtain a specific weighted sum?
  • Downgrade .Net Core project from 3.1 to 2.2 - The type or namespace name 'IWebHostEnvironment' could not be found
  • c# multiplying array elements using system.numerics
  • Private methods vs local functions
  • C# project wants .NET 4.7.1 but I can't install it
  • Binding to object itself, doesn't update when individual property changes
  • remove duplicate from list in object c#
  • JSON.NET - find JObject by value regex in complex object?
  • Save an unknown sized array from unknown string length
  • Camera not centre on player sprite (monogame)
  • How to set a default type for T in a static generic method?
  • How can I insert multiple items of data into SQL using Web API?
  • Finding longest time in an array
  • How to find two quotation marks in a string
  • X509Certificate2 certification issue
  • Image format change in Azure
  • Why is there such big time difference in searching for element with higher index in ConcurrentBag?
  • Async Lambda Issue
  • C# SSIS Script Task - Add Thousand Seperator when formatting Excel column
  • How to check if a textbox starts with numeric value
  • c# Strange Pairs || I can't spot the difference between these 2 solutions?
  • str.Split(".") not working in C# interactive window but work in C# .Net core project?
  • How to do 3 conditions with if else C#
  • merge two lists of same type in c#
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org