Create a controller and a razor view. In controller, set Response.ContentType = "text/xml".
In view, put
@{
Layout = null;
}
<?xml version="1.0" encoding="utf-8" ?>
Now run the view. No matter what you do the <?xml block will be on the 2nd line output, which of course is an invalid xml document.
Enter webforms pages. Create a view containing this all on first line in view:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" ContentType="text/xml" %><?xml version="1.0" encoding="utf-8" ?>
Webforms works and does not output extra lines - Razor does. Appears there is blank at the top and everytime there is @{} block. Here is another user reporting. http://stackoverflow.com/questions/11327787/empty-first-line-in-razor-mvc-4-rc
Comments: It makes no sense, razor code block shouldn't generate a whitespace. Why it's not fixed yet?
In view, put
@{
Layout = null;
}
<?xml version="1.0" encoding="utf-8" ?>
Now run the view. No matter what you do the <?xml block will be on the 2nd line output, which of course is an invalid xml document.
Enter webforms pages. Create a view containing this all on first line in view:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" ContentType="text/xml" %><?xml version="1.0" encoding="utf-8" ?>
Webforms works and does not output extra lines - Razor does. Appears there is blank at the top and everytime there is @{} block. Here is another user reporting. http://stackoverflow.com/questions/11327787/empty-first-line-in-razor-mvc-4-rc
Comments: It makes no sense, razor code block shouldn't generate a whitespace. Why it's not fixed yet?