Hi all
I’m including some css
files in my web app using WebResourceAttribute.
[assembly: WebResource("MyWebApp.Custom.Controls.CSS.MessageBox.css", "text/css")]
namespace MyWebApp.Custom.Controls
{
public class MessageBox : WebControl, INamingContainer
{
...
public void RegisterStyleSheet(Page page)
{
string csslink = "<link href='" + page.ClientScript.GetWebResourceUrl(this.GetType(),
"MyWebApp.Custom.Controls.CSS.MessageBox.css") +
"' rel='stylesheet' type='text/css' />";
LiteralControl include = new LiteralControl(csslink);
page.Header.Controls.Add(include);
}
...
This generates this
kind of html
<head>
...
<link href='/WebResource.axd?d=vVjymapQ8NgnF9dPwwk1nBHNmC71e9xXdBXLBsak7ZafMvPwpjMgr9vZFjnsTvZVaOTpt0K8iwEmECwLrNcIdg2&t=633378841003442963' rel='stylesheet' type='text/css' />
...
</head>
The thing is the
cryptic string fails the markup validation at w3.org. I’m getting errors and warnings, pointing to parts of the string (the & and the = in particular), like:
Warning: cannot generate system identifier for general entity "t".
Error: general entity "t" not defined and no default entity.
Warning: reference not terminated by REFC delimiter.
Warning: reference to external entity in attribute value.
Error: reference to entity "t" for which no system identifier could be generated.
Anyone know a workaround to this?
Thanks for any input!