| | |
Displaying a local webpage
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 7
Reputation:
Solved Threads: 0
I can't figure out how to display a local webpage. I've tried messing with the webBrowser control but it keeps adding "http://" to the front of the local webpage address, and if I try to change it from within the code like this:
I get the following error:
error CS1009: Unrecognized escape sequence
Can anyone help me out? The page I want to display is just one page, and it is stored locally in the same folder as the program.
Thanks in advance for any help!
C# Syntax (Toggle Plain Text)
webBrowser1.Url = "file:\\webpage\Maphs v1.htm";
error CS1009: Unrecognized escape sequence
Can anyone help me out? The page I want to display is just one page, and it is stored locally in the same folder as the program.
Thanks in advance for any help!
•
•
Join Date: Oct 2007
Posts: 172
Reputation:
Solved Threads: 16
The Uri type is not string so you have to implement the code as follow
C# Syntax (Toggle Plain Text)
webBrowser1.Url = new Uri( "file:\\webpage\Maphs v1.htm");
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
The file wont be at \\webpage\blah.htm, its at c:\webpage\blah.html
the \\something notation usually means machine name, is your PC really called "webpage"?
the \\something notation usually means machine name, is your PC really called "webpage"?
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Mar 2007
Posts: 7
Reputation:
Solved Threads: 0
ddanbe: I tried "webBrowser1.Navigate(webpage/Maphs v1.htm)", that gave me a 404.
LizR:
The HTML file is in a directory called "webpage", which is in the same directory as the program.
I wanted a local reference to the file, so that if I wanted to move the program's directory, it would work anyway. Evidently, that didn't happen.
Is there a way to make a local reference like that? Or should I just give up and hardcode the path in (which works)?
LizR:
The HTML file is in a directory called "webpage", which is in the same directory as the program.
I wanted a local reference to the file, so that if I wanted to move the program's directory, it would work anyway. Evidently, that didn't happen.
Is there a way to make a local reference like that? Or should I just give up and hardcode the path in (which works)?
Last edited by FlamingBlade; Dec 7th, 2008 at 11:44 am.
![]() |
Similar Threads
- displaying local (client side) images in webpage (JavaScript / DHTML / AJAX)
Other Threads in the C# Forum
- Previous Thread: error opening excel sheet in c#
- Next Thread: Function plotting in C#
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combobox control conversion csharp custom customactiondata database datagrid datagridview dataset date/time datetime datetimepicker degrees development dll draganddrop drawing encryption enum event excel file filename files form format forms function gdi+ gis gtk httpwebrequest image index input install java label list listbox mandelbrot math mouseclick mysql operator outlook2003 path photoshop picturebox pixelinversion pixelminversion post programming radians regex remote remoting richtextbox serialization server sleep socket sql statistics stream string table text textbox thread time timer tutorial update usercontrol validation visualstudio webbrowser webcam wia windows winforms wpf xml






