I am having issue on robots.txt file where red dot is somehow added in the beginning of the file.
- I am working in asp.net c#
- I am creating robots.txt file on my live site
- and Google search console is reading the live page
In my code, I don't see any dot or space or any additional characters, but a red dot appears in search console.
I have tried to change encoding type to ASCII from UTF-8 but nothing changed with that. Please find code and screenshot of error below.
public ContentResult BuilRobotsText()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("User-agent: *");
sb.AppendLine("Disallow: /multimedia/");
sb.AppendLine("Disallow: /fr-ca/media-gallery/details");
sb.AppendLine("Disallow: /en-ca/media-gallery/details");
sb.AppendLine("Disallow: /index.cfm");
sb.AppendLine("Disallow: /index.cfm/");
sb.AppendLine("Disallow: /en-ca/my-account");
sb.AppendLine("Disallow: /fr-ca/my-account");
sb.AppendLine("Disallow: /en-ca/error/");
sb.AppendLine("Disallow: /fr-ca/error/");
sb.AppendLine("Disallow: /*.html$");
sb.AppendLine("Disallow: /*.aspx$");
sb.AppendLine("Disallow: /*.aspx*");
var result = new ContentResult();
// Set the content-type
result.ContentType = "text";
//result.ContentEncoding = Encoding.UTF8;
result.ContentEncoding = Encoding.ASCII;
result.Content = sb.ToString().TrimStart();
return result;
}
Any help would be appreciated. Thanks in advance.