Hi can any one advice how I can sort out this error 

```
 **Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)**

```

Note that this error is not comming for all of the file rarely it is throwing, while writing string data in the file.

please find the below code which i am using in VB.net

```
Dim fso, file

strResult = "this is the sample string data"

strPath = it is local path only.

fso = CreateObject("Scripting.FileSystemObject")
file = fso.opentextfile(strPath, ForWriting, True)
file.write(strResult)
file.Close()

```