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 6361057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:43:37+00:00 2026-05-24T23:43:37+00:00

In my app I have a WebBrowser element. I would like to load a

  • 0

In my app I have a WebBrowser element.

I would like to load a local file in it.

I have some questions:

  1. Where to place the HTML file (so that it will also be installed if a user executes the setup)
  2. how to reference the file? (e.g. my guess is the user’s installation folder would not always be the same)

EDIT

I’ve added the HTML file to my project.

And I have set it up so that it gets copied to output folder.

When I check it it is present when run: \bin\Debug\Documentation\index.html

However when I do the following I get a ‘Page cannot be displayed’ error in the webbrowser element.

I use the following code to try to display the HTML file in the Webbrowser.

webBrowser1.Navigate(@".\Documentation\index.html");
  • 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. Editorial Team
    Editorial Team
    2026-05-24T23:43:38+00:00Added an answer on May 24, 2026 at 11:43 pm
    1. Do a right click->properties on the file in Visual Studio.
    2. Set the Copy to Output Directory to Copy always.

    Then you will be able to reference your files by using a path such as @".\my_html.html"

    Copy to Output Directory will put the file in the same folder as your binary dlls when the project is built. This works with any content file, even if its in a sub folder.

    If you use a sub folder, that too will be copied in to the bin folder so your path would then be @".\my_subfolder\my_html.html"

    In order to create a URI you can use locally (instead of served via the web), you’ll need to use the file protocol, using the base directory of your binary – note: this will only work if you set the Copy to Ouptut Directory as above or the path will not be correct.

    This is what you need:

    string curDir = Directory.GetCurrentDirectory();
    this.webBrowser1.Url = new Uri(String.Format("file:///{0}/my_html.html", curDir));
    

    You’ll have to change the variables and names of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET 2.0 app (using C#) that shows some dynamically constructed HTML
I have a winforms c# app that has an embedded webbrowser control inside it
I have a C# WinForm app with a WebBrowser control on it. I'd like
I have this App that uses the Webbrowser control to do automated browsing. I
I have a C# WinForms app, which uses WebBrowser to display some UI elements
I have a command line app and have the code chdir(/var); FILE *scriptFile =
On my rails app I have a list of items (like a task list)
While developing my app I have come to realize that the majority of my
In my app I have a tab bar. And in some views I as
In my C# app I get an xml from a server that contains some

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.