Open exrternal file in a WebBrowser control

This is a discussion on Open exrternal file in a WebBrowser control within the C# Programming forums, part of the General Programming Boards category; Hi I am trying to open an external file within a WebBrowser control. When I output the code to a ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    2

    Open exrternal file in a WebBrowser control

    Hi I am trying to open an external file within a WebBrowser control.

    When I output the code to a file it seems to work in internet explorer.

    Please can you give me some help???

    Code is as follows:-

    Code:
    public Form1()
            {
                InitializeComponent();
                MemoryStream HTMLMemory = new MemoryStream();
                StreamWriter HTMLWriter = new StreamWriter(HTMLMemory);
               
                HTMLWriter.Write("<html><body><input type=button onClick=\" window.location='file:///C:/RDR_Expert_Advisory/Anomaly_ID_surfaces_2010_v.avi'\" value=\"Open File\">");
              
                HTMLWriter.Flush();
                HTMLMemory.Position = 0;
                webBrowser1.DocumentStream = HTMLMemory;
    
                // Print code to a txt file
                StreamWriter sw = new StreamWriter("C:\\RDR_Expert_Advisory\\Test.htm");
                StreamReader sr = new StreamReader(HTMLMemory);
                sw.WriteLine(sr.ReadToEnd());
                sw.Close();
                HTMLMemory.Position = 0;
            }

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    So what is the problem with the code?

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    2
    The problem I get is a script error:

    "An error has occurred in the script on this page."

    Line 1
    Char 1
    Error Permission denied
    Code 0
    URL about:blank

  4. #4
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    That is the javascript debugger.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory Leak in AppWizard-Generated Code
    By jrohde in forum Windows Programming
    Replies: 4
    Last Post: 05-19-2010, 05:24 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  3. file processing updating record error
    By uuser in forum C Programming
    Replies: 2
    Last Post: 04-27-2003, 01:13 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21