Monday, April 2, 2018

OCD in rendering XML

Hi all,

I decided to learn .NET Core and got myself a pet project (TVML application). I created an empty ASP.NET Core Web App (MVC). And created a simple controller with a single view for it. Say ThingsController.cs and Views/Things/Index.cshtml accordingly.

I set the response content type in controller to text/xml and all the xml in Index.cshtml is rendered nicely (browser recognizes it as xml, not html). However this doesn't feel right to me (I might be wrong though as I'm new to the platform). Coming from RoR, I could have different content rendered to the client based on the extension of the view (e.g. .html.erb for html and .xml.erb for xml). Is there a way to make my controller search for Index.csxml file?

OCD in rendering XML Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team