Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have two methods.one method is used for passing the data through the body at the time i can possible to pass the body in json format and also another method for passing the data through header in json format but i need to combine both json response to single jsonobject format how can do this.many of examples i seen it's not worked for me.please help me.

Body data code

C#
[Httppost]
[Route("api/Account/Login")]
public async task<getbasecustomerresponse> Login([From body]LoginRequest request)
{

   
   

 return response;
}


Header data code:

C#
private HttpWebRequest CreateRequestObject(string ServiceURL)
{
   HttpWebRequest request=null;
   try
   {
      var _authkey=configurationManger.APPSetting["userkey"];
      request=(HttpWebRequest)WebRequest.Create(ServiceURL)
      request.Method="Post";
      request.ContentType="Application/Json";
      request.Headers.Add("AuthKey",_authkey);
   }
   catch(Exception ex)
  {
  }
 return request

}




please help me,

Thank u.

What I have tried:

i have two methods.one method is used for passing the data through the body at the time i can possible to pass the body in json format and also another method for passing the data through header in json format but i need to combine both json response to single jsonobject format how can do this.many of examples i seen it's not worked for me.please help me.
Posted
Updated 23-Dec-18 0:10am

1 solution

I would have a look at this. It has an example too

Merging JSON[^]
 
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