Access denied to folder - vb.net

In my vb.net project, I want to save a ima in a folder, but I have this error:
System.UnauthorizedAccessException: Access to the path '\192.168.100.1\T-Dev\Docs\AGRFOB6NV0UM835B59MX34KT2.jpg' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at P_ControlDoc46.Controllers.U_controldocController.UploadFile(HttpPostedFileBase postedFile, String descricao) in C:\Users\Pedro Moreira\Desktop\P_ControlDoc46\Controldoc-trimalhas\P_ControlDoc46\Controllers\U_controldocController.vb:line 146/DocsTeste/AGRFOB6NV0UM835B59MX34KT2.jpg
The code that I use to save the file is the following:
Try
'Save the Byte Array as Image File.
Dim filePath As String = Server.MapPath(String.Format(WebConfigurationManager.AppSettings("DocsFolder") + "{0}.jpg", fileName))
postedFile.SaveAs(filePath)
Catch ex As Exception
Console.WriteLine(ex)
Return RedirectToAction("IndexCreate", "U_controldoc")
End Try
Can someone help me?
Thanks

Related

Operating on excel sheet in Visual Basic

I'm trying to edit an excel sheet to remove some duplicate data. My macro works fine in Excel.
When I try to do the same in visual studio 2008, Im facing an issue:
The code is :
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic 2008.
' The ScriptMain is the entry point class of the script.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.Office.Interop
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts property. Connections, variables, events,
' and logging features are available as members of the Dts property as shown in the following examples.
'
' To reference a variable, call Dts.Variables("MyCaseSensitiveVariableName").Value
' To post a log entry, call Dts.Log("This is my log text", 999, Nothing)
' To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, True)
'
' To use the connections collection use something like the following:
' ConnectionManager cm = Dts.Connections.Add("OLEDB")
' cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;"
'
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Help, press F1.
Public Sub Main()
Dim oExcel As Excel.ApplicationClass
Dim oBook As Excel.WorkbookClass
Dim oBooks As Excel.Workbooks
Dim i As Long
Dim Col As Long
Dim setErrorFilePath As String
Dim setErrorFileName As String
' Dim xlTmp As Excel.Application
'Set(xlTmp = New Excel.Application)
' xlTmp.Workbooks.Open("C:\Book1.xls")
setErrorFilePath = Dts.Variables("ErrorFilePath").Value.ToString
setErrorFileName = Dts.Variables("ErrorFileName").Value.ToString
'Start Excel and open the workbook.
oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
oBooks = oExcel.Workbooks
oBook = oBooks.Open(setErrorFilePath + setErrorFileName) ' Change your variable name here.
'Macro to format Excel
'Deleting the first four rows
oExcel.Rows("1:6").EntireRow.Delete()
'Unmerging The Cells
oExcel.Cells.UnMerge()
'Deleting Empy Columns after unmerging
With oExcel.ActiveSheet.UsedRange
Col = .Columns(.Columns.Count).Column
End With
For i = Col To 1 Step -1
If oExcel.Application.CountA(oExcel.Columns(i)) = 0 Then
oExcel.Columns(i).Delete()
End If
Next
'Run the macros.
'Clean-up: Close the workbook and quit Excel.
oBook.Save()
oExcel.Quit()
Dts.TaskResult = ScriptResults.Success
End Sub
End Class
Im getting the following error:
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Range.set__Default(Object RowIndex, Object ColumnIndex, Object )
at ST_7bdc1448ef3b4c8db7fb8d5574f78c18.vbproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
I searched other places and the solution mentioned was to create a folder in c->windows->system32->config etc..
however I don't have the admin access and I can't get it.
How can I solve this ? Please Help

ProgramData. Access denied (VB.NET 2008)

I am storing .dat files in ProgramData to write and read configurations about my software. I can read, but I can't write. These .dat files are copied when software is installed. The installer has been created with AwInstall.
CODE TO WRITE .DAT:
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\NameSoftware\Configuration\paramsBiz.dat") = True Then
Dim sw As StreamWriter = New StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\NameSoftware\Configuration\paramsBiz.dat")
sw.Write(myString)
sw.Close()
sw = Nothing
Return True
Else
Return False
End If
ERROR:
I am getting this error:
System.UnauthorizedAccessException: Acceso denegado a la ruta de acceso 'C:\ProgramData\NameSoftware\Configuration\paramsBiz.dat'.
en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
en System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
en System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
en System.IO.StreamWriter.CreateFile(String path, Boolean append)
en System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
en System.IO.StreamWriter..ctor(String path)
UPDATE 1:
ok, is a problem with this directory ProgramData, as has been said Hans Passant
But alternative path could be used to store data and that any user (admin or not) can read and write these files?

Why does "Inherits Microsoft.Web.Services2.WebServicesClientProtocol" kill build

I'm trying to write an Outlook add-in in Visual Basic (in Visual Studio 2012 Professional on Windows 7) that will interface with a web service we use at work. Unfortunately this particular web service doesn't really stay with the times and as such, requires the Web Reference to implement Microsoft.Web.Services2.WebServicesClientProtocol to do certain things. When I change the generated Reference.vb to inherit this class instead of the default and Rebuild All, the build fails with the message:
------ Rebuild All started: Project: OutlookAddIn1, Configuration: Debug Any CPU ------
OutlookAddIn1 -> \\nas01\my-home$\chq-andrewt\Visual Studio 2012\Projects\OutlookAddIn1\OutlookAddIn1\bin\Debug\OutlookAddIn1.dll
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: The "FindRibbons" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'OutlookAddIn1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: File name: 'OutlookAddIn1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.Reflection.Assembly.Load(String assemblyString)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at Microsoft.Build.Framework.ITask.Execute()
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: === Pre-bind state information ===
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: DisplayName = OutlookAddIn1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: (Fully-specified)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: Initial PrivatePath = NULL
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: Calling assembly : (Unknown).
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: ===
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: This bind starts in default load context.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: Using application configuration file: C:\Users\chq-andrewt\AppData\Local\Microsoft\VisualStudio\11.0\devenv.exe.config
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: Using host configuration file:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: LOG: The same bind was seen before, and was failed with hr = 0x80070002.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018:
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I've found that the crash doesn't happen because of the change to Reference.vb specifically. I can consistently reproduce this if I create a new Outlook 2013 Add-In project, create a new class, and have it inherit Microsoft.Web.Services2.WebServicesClientProtocol:
Public Class Class1
Inherits Microsoft.Web.Services2.WebServicesClientProtocol
End Class
Once I make that change, I add Microsoft.Web.Services2.dll to the project References and after some prompting, System.Web.Services.dll. I rebuild all and promptly get the above error.
I've found that if I use Microsoft.Web.Services3.WebServicesClientProtocol instead, it works fine.
This is my first Visual Basic project (and any project using Microsoft tools, for that matter), so I may be missing something painfully obvious. The choice to use this web service (and WSE2 by extension) wasn't my choice; I'm trying to interface with something others have already purchased.
I've reinstalled Visual Studio with no luck.
Any hints on why this is happening or how to troubleshoot this a bit more? Thanks in advance!
It turns out that WSE 2 is simply too old. It only supports the .NET framework up to version 2, which is I think why it was tanking. I'm using 4.5 (could only go as low as 4) since I was writing an Outlook 2013 add-in. Since there isn't any built-in functionality for doing SOAP attachments AT ALL, I ended up POSTing the raw SOAP message by hand as it was a free solution and pretty straightforward.
No comment on how resilient and future-proof it is...
Public Shared Sub createAttachment(uploadPath As String, fileName As String, ticketHandle As String, description As String)
Dim fInfo As New FileInfo(uploadPath)
Dim numBytes As Long = fInfo.Length
Dim fStream As New FileStream(uploadPath, FileMode.Open, FileAccess.Read)
Dim br As New BinaryReader(fStream)
Dim data As Byte() = br.ReadBytes(CInt(numBytes))
br.Close()
fStream.Close()
Dim boundary As String = "Part_3_4083017.1413597427118"
' Set the 'Method' property of the 'Webrequest' to 'POST'.
Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create("http://soapserver:8080/axis/services/USD_R11_WebService"), HttpWebRequest)
myHttpWebRequest.Method = "POST"
myHttpWebRequest.UserAgent = "Jakarta Commons-HttpClient/3.1"
myHttpWebRequest.Host = "soapserver:8080"
myHttpWebRequest.ContentType = "multipart/related; type=""text/xml""; start=""<rootpart#soapui.org>""; boundary=""----=_" & boundary & """"
Dim myWebHeaderCollection As WebHeaderCollection = myHttpWebRequest.Headers
myWebHeaderCollection.Add("MIME-Version: 1.0")
myWebHeaderCollection.Add("Accept-Encoding: gzip,deflate")
myWebHeaderCollection.Add("SOAPAction:""""")
'myWebHeaderCollection.Add("Expect:100-continue")
Dim inputData As String = Console.ReadLine()
Dim postData As New StringBuilder()
postData.Append("------=_" & boundary & vbCrLf)
postData.Append("Content-Type: text/xml; charset=UTF-8" & vbCrLf)
postData.Append("Content-Transfer-Encoding: 8bit" & vbCrLf)
postData.Append("Content-ID: <rootpart#soapui.org>" & vbCrLf)
postData.Append("" & vbCrLf)
postData.Append("<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ser=""http://www.vendorurl.com/TheirProduct"">")
postData.Append("<soapenv:Header/>")
postData.Append("<soapenv:Body>")
postData.Append("<ser:createAttachment>")
postData.Append("<sid>" & sid & "</sid>")
postData.Append("<repositoryHandle>" & getRepositoryHandle() & "</repositoryHandle>")
postData.Append("<objectHandle>" & ticketHandle & "</objectHandle>")
postData.Append("<description>" & description & "</description>")
postData.Append("<fileName>" & uploadPath & "</fileName>")
postData.Append("</ser:createAttachment>")
postData.Append("</soapenv:Body>")
postData.Append("</soapenv:Envelope>" & vbCrLf)
postData.Append("------=_" & boundary & vbCrLf)
postData.Append("Content-Type: image/x-png; name=" & fileName & vbCrLf)
postData.Append("Content-Transfer-Encoding: binary" & vbCrLf)
postData.Append("Content-ID: <" & fileName & ">" & vbCrLf)
postData.Append("Content-Disposition: attachment; name=""" & fileName & """; filename=""" & fileName & """" & vbCrLf)
postData.Append("" & vbCrLf)
Dim encoding As New UTF8Encoding()
Dim header As Byte() = encoding.GetBytes(postData.ToString)
Dim tail As Byte() = encoding.GetBytes(vbCrLf & "------=_" & boundary & "--")
myHttpWebRequest.ContentLength = header.Length + data.Length + tail.Length
Dim newStream As Stream = myHttpWebRequest.GetRequestStream()
newStream.Write(header, 0, header.Length)
newStream.Write(data, 0, data.Length)
newStream.Write(tail, 0, tail.Length)
newStream.Close()
Try
Dim response = myHttpWebRequest.GetResponse()
Dim s As Stream = response.GetResponseStream()
Dim sr As New StreamReader(s)
Dim Content As String = sr.ReadToEnd()
'Could parse Content to get the handler for our new attachment
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

How do I allow concurrent reads and writes to a serialized binary file

I wrote a module to serialize a generic list into a binary file. If I wanted to allow multiple users to write to a file at the same time, or multiple users to read from the file at the same time, what do I need to do? I know there is a FileAccess enumeration I can pass to my filestream, but I am not sure what the limitations are, or what to set it as.
If FileAccess is for something else, what other solutions are there? (no databases)
Dim _Format As New BinaryFormatter
Public Function SavePack(Of T)(Filename As String, Output As T) As Boolean
SavePack(New FileStream(Filename, FileMode.Create), Output)
End Function
Public Function SavePack(Of T)(Stream As FileStream, Output As T) As Boolean
Dim Result As Boolean = False
Try
_Format.Serialize(Stream, Output)
Catch ex As Exception
Stream.Close()
End Try
Return Result
End Function

Exception converting Office files to PDF using ABCpdf.NET onWindows Server 2008

Has anyone delt with this exception from ABCpdf? We're running on Server 2008 and only have issues converting Office files (Word and Excel). This all worked well on Server 2003. Because we're only having issues with Office files I wonder if it's related to the XPS support on Server 2008? The code that calls into this function is running as a Windows Service.
Private Overloads Function ConvertMicrosoftOfficeDocToPdf(ByVal inputFile As Byte(), ByVal fileExt As String) As Byte()
Dim abcDoc As WebSupergoo.ABCpdf7.Doc = Nothing
Try
abcDoc = New WebSupergoo.ABCpdf7.Doc()
Dim xro As New WebSupergoo.ABCpdf7.XReadOptions()
xro.FileExtension = fileExt
Try
abcDoc.Read(inputFile, xro)
Catch ex As Exception
System.Diagnostics.Trace.Write(ex.ToString())
Throw ex
End Try
Dim fileBytes As Byte() = abcDoc.GetData()
Return fileBytes
Finally
If Not abcDoc Is Nothing Then
abcDoc.Clear()
abcDoc.Dispose()
End If
End Try
End Function
WebSupergoo.ABCpdf7.Internal.PDFException:
Attempted to read or write protected
memory. This is often an indication
that other memory is corrupt. --->
System.AccessViolationException:
Attempted to read or write protected
memory. This is often an indication
that other memory is corrupt.
at WebSupergoo.ABCpdf7.Internal.NDoc._InvokeMethod(IntPtr
inDoc, Int32 inMethod, Int32 inIndex,
Int32 inFlags, String inParams,
String& outErr)
at WebSupergoo.ABCpdf7.Internal.NDoc.InvokeMethod(IntPtr
inDoc, Int32 inMethod, Int32 inIndex,
Int32 inFlags, String inParams,
String& outErr)
at WebSupergoo.ABCpdf7.Doc.PrintToXps(String
inputFile, String outputFile, Int32
timeout, String printerName)
at WebSupergoo.ABCpdf7.Operations.XpsImportOperation.ImportAny(Doc
doc, String path, Int32 timeout)
at WebSupergoo.ABCpdf7.XReadOptions.ImportXpsAny(Doc
doc, String path, Boolean clear)
at WebSupergoo.ABCpdf7.XReadOptions.Read(Doc
doc, Byte[] data, ReadModuleType
module)
at WebSupergoo.ABCpdf7.XReadOptions.Read(Doc
doc, Byte[] data)
Added a folder called "Desktop" here:
C:\Windows\SysWOW64\config\systemprofile\
http://social.msdn.microsoft.com/Forums/en/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91
Actual problem is that the folder where you are trying write the file, give the write permission to IIS_IUSR. Then it should work.