Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 38359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:41:45+00:00 2026-05-10T14:41:45+00:00

I’m using a winforms webbrowser control to display some content in a windows forms

  • 0

I’m using a winforms webbrowser control to display some content in a windows forms app. I’m using the DocumentText property to write the generated HTML. That part is working spectacularly. Now I want to use some images in the markup. (I also would prefer to use linked CSS and JavaScript, however, that can be worked around by just embedding it.)

I have been googling over the course of several days and can’t seem to find an answer to the title question.

I tried using a relative reference: the app exe is in the bin\debug. The images live in the ‘Images’ directory at the root of the project. I’ve set the images to be copied to the output directory on compile, so they end up in bin\debug\Images*. So I then use a reference like this ‘Images…’ thinking it will be relative to the exe. However, when I look at the image properties in the embedded browser window, I see the image URL to be ‘about:blankImages/*’. Everything seems to be relative to ‘about:blank’ when HTML is written to the control. Lacking a location context, I can’t figure out what to use for a relative file resource reference.

I poked around the properties of the control to see if there is a way to set something to fix this. I created a blank html page, and pointed the browser at it using the ‘Navigate()’ method, using the full local path to the file. This worked fine with the browser reporting the local ‘file:///…’ path to the blank page. Then I again wrote to the browser, this time using Document.Write(). Again, the browser now reports ‘about:blank’ as the URL.

Short of writing the dynamic HTML results to a real file, is there no other way to reference a file resource?

I am going to try one last thing: constructing absolute file paths to the images and writing those to the HTML. My HTML is being generated using an XSL transform of a serialized object’s XML so I’ll need to play with some XSL parameters which will take a little extra time as I’m not that familiar with them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:41:45+00:00Added an answer on May 10, 2026 at 2:41 pm

    Here’s what we do, although I should mention that we use a custom web browser to remove such things as the ability to right-click and see the good old IE context menu:

    public class HtmlFormatter {     /// <summary>     /// Indicator that this is a URI referencing the local     /// file path.     /// </summary>     public static readonly string FILE_URL_PREFIX =          'file://';      /// <summary>     /// The path separator for HTML paths.     /// </summary>     public const string PATH_SEPARATOR = '/'; }   // We need to add the proper paths to each image source // designation that match where they are being placed on disk. String html = HtmlFormatter.ReplaceImagePath(     myHtml,      HtmlFormatter.FILE_URL_PREFIX + ApplicationPath.FullAppPath +      HtmlFormatter.PATH_SEPARATOR); 

    Basically, you need to have an image path that has a file URI, e.g.

    <img src='file://ApplicationPath/images/myImage.gif'> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.