In my C# program, I am utilizing a web browser control and setting its HTML property programmatically by loading it from an HTML string variable. While this setup works almost perfectly, I have noticed that it loses the reference to the CSS file. I believe the simplest solution would be to make the path of the CSS file absolute, but ideally, I want it to remain relative to the C# executable. Can someone please advise on how to ensure the HTML maintains reference to the CSS file in this context?
Thank you in advance.
Edit: Apologies for the confusion. My C# application is actually a desktop one, even though it utilizes a web browser control. Edit: Let me provide some code. Initially, I load the document from an HTML file and store it in a variable, then for subsequent times, I reload the document from the variable.
//first load
web_browser_control.Url = new Uri( dir + @"\HTML\default1.html" );
void wB2_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{ html_string = web_browser_control.DocumentText; }
//second load or later
web_browser_control.DocumentText = html_string;