Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I want to send data from one controller which is present in "Domain1" to another controller which is present in another "Domain2". It some sort of redirect from that website to here with some data. I should be doing this in mvc c#. Please give me some sample working code

What I have tried:

I did not tried anything!!! Please give me some sample code
Posted
Updated 10-Jan-17 22:59pm
Comments
F-ES Sitecore 11-Jan-17 4:48am    
It's not clear what you want to do from your question, but if you want to redirect the user to a different website and pass that site some data you will need to do it on the querystring. Do a Redirect to the site but add what you need to the url

http://www.targetsite.com/controller/action?mydata=yourdatahere

Obviously the other site needs to know what query param you are sending and how to deal with it.
jing567 12-Jan-17 0:34am    
I am trying to send them through xml result in the url... But the url length limitation is being done.Half content only is being sent

try to create from App1 Post requset using WebClient or HttpRequset
and post Object .
In the other side App2 create post method that get this massage:

[HttpPost]
Public actionResult GetDataFromApp1(DataObject data)
{
//Your Logic
}

*** You can encrypte your data if you wont privacy on the web.
or craete filter Attribute to this action method that say only App1 Host can Invoke this method .
 
Share this answer
 
v2
Move your data classes into external dll, then refer that both places i.e. class Acme sits in your namespace myspace.one and you want it in myspace.two, then move it to myspace.types and refer that both places in myspace.one and myspace.two and they can be aware and handle same types.

Actual data when leaving application boundries for instance should be serialized in one and deserialized in the other for the most easy approach.

There are countless of examples of both techniques, and you will have to do some work yourself :) but here is example of two ways of making data serializable
Binary Serialization with C# and .NET « John Nelson's Blog[^]
How to: Serialize and Deserialize JSON Data[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900