Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 21, 2012 07:38 PM by bruce (sqlwork.com)
Participant
1765 Points
523 Posts
Jan 21, 2012 03:06 PM|LINK
Hi,
I want to send XML from A-controller(Index action method) to B-controller(Reorder action method).
I'm using RedirectToAction("Reorder", "B-controller", "here XML as string");
But Im not getting xml in B-controller Reorder action method. How to use send this xml to other controller?
NOTE: XML size will be 10KB or more.
Should we send as XMLDocument or Hashtable or some other method?
Jan 21, 2012 03:07 PM|LINK
I'm usign MVC3
Star
7784 Points
1232 Posts
Jan 21, 2012 03:47 PM|LINK
try to use something like this :
Acontroller
public class AController : Controller { // // GET: /A/ public ActionResult Index() { string xmlcontent = "<Product><Id>1</Id></Product>"; return RedirectToAction("Record", "B", new System.Web.Routing.RouteValueDictionary(new { content = xmlcontent })); } }
BController
public class BController : Controller { // // GET: /B/ public ActionResult Index() { return View(); } [ValidateInput (false )] public ActionResult Record(string content) { return Content(content); } }
Jan 21, 2012 07:04 PM|LINK
I tried the above solution. I am able to pass small data .. but not xml. Im getting Http 400 error
All-Star
36822 Points
5441 Posts
Jan 21, 2012 07:38 PM|LINK
urls's are limited to 2K, so you can not pass much data via a redirct. you store the xml server side (static collection, databases, etc), and pass a lookup key in the redirect.
mchinta
Participant
1765 Points
523 Posts
Pass XML data between two controllers --> URGENT
Jan 21, 2012 03:06 PM|LINK
Hi,
I want to send XML from A-controller(Index action method) to B-controller(Reorder action method).
I'm using RedirectToAction("Reorder", "B-controller", "here XML as string");
But Im not getting xml in B-controller Reorder action method. How to use send this xml to other controller?
NOTE: XML size will be 10KB or more.
Should we send as XMLDocument or Hashtable or some other method?
mchinta
Participant
1765 Points
523 Posts
Re: Pass XML data between two controllers --> URGENT
Jan 21, 2012 03:07 PM|LINK
I'm usign MVC3
Ahmed Moosa
Star
7784 Points
1232 Posts
Re: Pass XML data between two controllers --> URGENT
Jan 21, 2012 03:47 PM|LINK
Hi,
try to use something like this :
Acontroller
public class AController : Controller { // // GET: /A/ public ActionResult Index() { string xmlcontent = "<Product><Id>1</Id></Product>"; return RedirectToAction("Record", "B", new System.Web.Routing.RouteValueDictionary(new { content = xmlcontent })); } }BController
public class BController : Controller { // // GET: /B/ public ActionResult Index() { return View(); } [ValidateInput (false )] public ActionResult Record(string content) { return Content(content); } }MCC - MCPD -MCTS
mchinta
Participant
1765 Points
523 Posts
Re: Pass XML data between two controllers --> URGENT
Jan 21, 2012 07:04 PM|LINK
I tried the above solution. I am able to pass small data .. but not xml. Im getting Http 400 error
bruce (sqlwo...
All-Star
36822 Points
5441 Posts
Re: Pass XML data between two controllers --> URGENT
Jan 21, 2012 07:38 PM|LINK
urls's are limited to 2K, so you can not pass much data via a redirct. you store the xml server side (static collection, databases, etc), and pass a lookup key in the redirect.