Content not properly loaded while using Htmldocument.Load() method
I am using the HtmlAgilityPack to do some changes in the existing html file. So, I have used the below code to load the html content.
string html = "Sample.cshtml";
HtmlDocument htmlContent = new HtmlDocument();
htmlContent.Load(html);
After load the html file some content has been changed which is differ from the original content. Please refer the below screenshot.
Before Load HTML file:

After Load HTML file:

Please suggest the solution to resolve this issue.
Thanks, Ganesan R.
Hello @GanesanRengasamy ,
Unless I'm wrong, HAP has not been built to support Razor template.
Issue - applicationuser
Instead of skipping this template line, HAP currently parse it like an HTML tag, that's why the closing tag is added at the end.
Issue - returnurl
Currently, you use double quote inside a double quote. While it's valid in your template, that's not currently valid for HTML, which cause the following difference.
I have added this request to our todo list, however, at this moment, we prefer to concentrate our time on adding online documentation and fixing some basic bug instead of adding new features like this one.
So, unfortunately, that will not be fixed before a few months.
Best Regards,
Jonathan
Hi @JonathanMagnan
Thanks for your response. I am waiting for this feature.
Hi @JonathanMagnan ,
I have faced similar issue like this. Is there any workaround for this bug ?
@JonathanMagnan - Any update regarding this ?
Hello @Abbas1546 ,
Unfortunately, as we said, we will not look on this issue before a few months.
HAP has been created to parse HTML not Razor/MVC file. We currently get more request than we can handle for this library.
During the summer (next months), we may start to look about either creating a v2 version of the parser for handling more scenario like this one, but we cannot guarantee anything currently.
Best Regards,
Jonathan
@JonathanMagnan Any update on this?
Hello @GanesanRengasamy ,
Unfortunately no yet,
We currently looking to fully rewrite Html Agility Pack to make it more flexible and support some code like Razor but we cannot provide or commit our self to any date at this time.
Best Regards,
Jonathan
Hi @JonathanMagnan
Could you please update me is there this feature has been included or not in HAP?
Hello @Syncfusion-JavaScript ,
No, supporting other languages such as Razor is not yet supported.
Best Regards,
Jonathan