Solved

Modify file displayed in AxSHDocVw.AXWebBrowser

Posted on 2006-07-11
11
349 Views
Last Modified: 2012-06-21
Hi,
I am working on a vb.net windows application. (windows 2000 / .net 1.1)

I have an issue with the webbrowser control (AxSHDocVw.AXWebBrowser).
The webbrowser control contains an html page loaded from local disk. However when I try to modify the html file (in Notepad or whatever) I get this error:
    "The process cannot access the file because it is being used by another process."

How can I modify the html file while it is in the web browser control??
Thanks
0
Comment
Question by:gjok
  • 5
  • 5
11 Comments
 
LVL 5

Expert Comment

by:vinodhsomasekharan
ID: 17080873
I can not get any problems :(
Can u post your code ?

regards
vinu
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17082070
1) .NET version?  2002, 2003, or 2005?

2) What are you trying to accomplish here?

Bob
0
 
LVL 2

Author Comment

by:gjok
ID: 17084989
Bob, Not sure about the year (2003 ??). I'm using .NET Framework version 1.1

What I have is a windows form containing a web browser control called AxWebBrowser1.
AxWebBrowser1 contains an htm file which is located on the local disk (C:).

If I open and modify the htm file in notepad, I cant save it due to a sharing violation:
   "The process cannot access the file because it is being used by another process."

vinu,
There isnt any code yet, except for:
AxWebBrowser1.Navigate(MyUrl)
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17085824
I ran a test with AxWebBrowser and this code:

   Me.AxWebBrowser1.Navigate("file://c:\temp\temp.html")

It let me open the file in Notepad and save it.  What does your URL look like?

Bob
0
 
LVL 2

Author Comment

by:gjok
ID: 17086301
Mine's the same format - looks like this:
AxWebBrowser1.Navigate("file://" & App_Path & "\reports\492.htm")

I've tried different drives and folders, also to no avail.
Security on the htm file is set to "Everyone", full control.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 17086317
What are the rights for the folder?  Rights are cumulative and are the most restrictive settings, so if you have defined rights at a higher level, there is a set of effective rights.

Bob
0
 
LVL 2

Author Comment

by:gjok
ID: 17086443
I'm no expert on security, but I dont think that it. I've been trying many folders that I use regularly, as well as new test folders.
The original htm file was created manually. I've since also tried creating and reloading the file programatically from the actual application itself.
I am only able to save the htm file when I stop debugging.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17086458
Well, I can't look over your shoulder and figure this one out, so I am depending on you to describe your environment as fully as possible.  There is always the FileMon utility from Sysinternals.

Bob
0
 
LVL 2

Author Comment

by:gjok
ID: 17086519
Hang on - I've found the problem - I still dont know how to resolve it though..

Another piece of code is running in the same sub that loads the htm file. When I comment it out it works. So it looks like the commented code (below) is still keeping the file/stream open.
How do I close the stream?

    'Dim MyUrl As String = "file://" & App_Path & "\reports\492.htm"
    'Dim req As WebRequest = WebRequest.Create(MyUrl)
    'Dim resp As WebResponse = req.GetResponse()

    'Dim s As Stream = resp.GetResponseStream()
    'Dim sr As StreamReader = New StreamReader(s, Encoding.ASCII)
    'Dim doc As String = sr.ReadToEnd()

    AxWebBrowser1.Navigate("file://" & App_Path & "\reports\492.htm")
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 17086539
1) If this is a file on your local drive, and not across the Internet, then the WebRequest is not needed.

2) If you are using a WebBrowser to navigate to the file, then again the WebRequest is not needed.

3) So, given all that, why are you using it?

Bob
0
 
LVL 2

Author Comment

by:gjok
ID: 17086692
I was planning to parse bits of the htm file for certain values, for use in the programs Form (i.e labels).
However, I could access this data another way.

Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now