Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Razor outputs blank lines [481]

$
0
0
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?

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>