Strange "" quotes in html before running asp.net

I see a very strange problem with rendering asp.net. I EXACTLY this in the corresponding part of .aspx (just replaced the names of paths and controls):

<div id="header">
 <% if (SiteSettings.SiteName.Equals("sx") || SiteSettings.SiteName.Equals("sw"))
    { %>
        <sc:sublayout runat="server" renderingid="{B04CFA1A-6B5B-49D3-8000-339DBE9899C1}"
          path="/layouts/AX/HeaderSublayout.ascx" id="AXHeader" placeholder="content"></sc:sublayout>
 <% }
    else
    { %><!-- bla1 --><ax:strangeBehavingControl id="HeaderInclude" runat="server" IncludeType="Header" /><!-- bla2 -->
 <% } %>
</div>

The displayed html is as follows:

<!-- bla1 -->
""
expected content from strangeBehavingControl
<!-- bla2 -->

The .ascx for strangeBehavingControl is really simple:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="strangeBehavingControl.ascx.cs" Inherits="layouts.strangeBehavingControl" %>

there are no extra spaces anywhere, it has been checked many times already. the code behind is also very simple:

public partial class strangeBehavingControl: System.Web.UI.UserControl
    {

    protected override void Render(HtmlTextWriter writer)
        {
            var filePath = GetFilePath();
            if (!string.IsNullOrWhiteSpace(filePath) && File.Exists(Server.MapPath(filePath)))
                Response.WriteFile(filePath);
        }  
    }

so I thought the weird "" inside the embedded files, but I checked them manually, and they start with the expected characters. any idea how these characters can be inserted there?

+3
source share
2 answers

. HtmlTextWriter, , - Response.

, UserControl, . , HTML, ?

Render :

protected override void Render(HtmlTextWriter writer)
{
    var filePath = GetFilePath();
    if (!string.IsNullOrWhiteSpace(filePath) && File.Exists(Server.MapPath(filePath)))
        using (var sr = new StreamReader(filePath))
            writer.Write(sr.ReadToEnd());
}  
+3

. , , . , , .

, Render().

+2

All Articles