ASP.NET localized ASPX page titles revert to page URL after postback

You may have an ASPX where you have used a resource file to set the title in the ASPX markup, all looks good viewing the page until you click something on the page which causes a postback.


<title>
    <asp:Literal ID="titleLiteral" runat="server" EnableViewState="false" Text="<%$ Resources:EventLog, EventLogTitle %>" />
</title>


The page title then reverts to the URL of the page. Strange. The solution is to put all of the markup on a single line and then it works


<title><asp:Literal ID="titleLiteral" runat="server" EnableViewState="false" Text="<%$ Resources:EventLog, EventLogTitle %>" /></title>


Not sure why this is the case, but it's an easy fix at least.

Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.