none
Urgent: How to return the response like the below framework code in Dotnet core webapi RRS feed

  • Question

  • Hi every one,

    Blow is my code working fine in framework code and I need to do the same in dotnet core. I tried and unable to get any luck. Hope some one may knw this and pls reply as soon as possible. 

    	public ActionResult getsample(String obj)
    		{
    			//...
    			//...
    			// etc..
    			if (headerValues == "application/json")
    			{
    				return Content(HttpStatusCode.OK, resultObject, new JsonMediaTypeFormatter { SerializerSettings = { NullValueHandling = NullValueHandling.Ignore } });
    			}
    			else
    				return Content(HttpStatusCode.OK, resultObject, Configuration.Formatters.XmlFormatter);
    		}

    Thanks

    JoSwa


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful" Best Online Journal

    • Moved by CoolDadTx Thursday, December 5, 2019 3:01 PM ASP.NET related
    Thursday, December 5, 2019 10:56 AM

All replies