Logon Failure- Unknown username or bad password

Hi,

I'm having some issues converting .doc to .pdf. It keeps on throwing is "Logon Failure, Unknown username or bad password".

This works fine in my dev environment, but it seems to be an issue on my hosted environment. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The error is thrown on the pdf.Save( ) method. Weather, I pass in a stream or a filename.

The .doc file that I’m trying to convert to .pdf contains an image and few shapes and the rest is text. I think the problem lies with the image; in combination with our hosted environment. Our hosted environment is controlled by a 3rd party and its running of a NAS server. So all paths are relative (even if you go Server.MapPath(“...”) you will get \\nasserver\\websitedir\\temp.doc. And I think that is why it is crashing and burning in pdf.Save(). When it creates a temp image file; in using this temp image file throws the above below.

When I remove that image and run it again, everything is fine. It creates the .pdf perfectly. Very weird. Have you guys come across this issue before?


Logon failure: unknown user name or bad password.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Logon failure: unknown user name or bad password.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[IOException: Logon failure: unknown user name or bad password.

]

System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2056933

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) +1038

System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) +125

System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async) +45

System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint) +80

[WebException: Logon failure: unknown user name or bad password.

]

System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint) +557

System.Net.FileWebRequest.GetResponseCallback(Object state) +309

[WebException: Logon failure: unknown user name or bad password.

]

System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult) +227

System.Net.FileWebRequest.GetResponse() +231

Aspose.Pdf.Figure.௟.ౣ(Uri ة) +97

Aspose.Pdf.Figure..(ط , Int32 , String ؼ, Boolean , Stream ل) +626

Aspose.Pdf.Figure..(ط , Int32 , ImageFileType ػ, String ؼ, String ؽ, String ؾ, Int32 ؿ, Int32 ـ, Boolean ف, Boolean ق, Boolean , Byte[] ك, Stream ل) +2859

Aspose.Pdf.Figure.ط.ع(Image غ, ImageFileType ػ, String ؼ, String ؽ, String ؾ, Int32 ؿ, Int32 ـ, Boolean ف, Boolean ق, Byte[] ك, Stream ل) +491

Aspose.Pdf.Xml..(Pdf Ә, Image غ) +1151

Aspose.Pdf.Xml..(Pdf , Paragraph , Single ى) +1820

Aspose.Pdf.Xml..(Pdf Ә, Cell ෕) +1578

Aspose.Pdf.Row.๥(Pdf Ә) +233

Aspose.Pdf.Table.GetHeight(Pdf doc) +188

Aspose.Pdf.Xml..(Pdf Ә, Section , Table , ൜ ඀, Boolean ) +15108

Aspose.Pdf.Xml.ᤏ.ᤑ(Pdf Ә, Section , Cell , FloatingBox ᤒ, ൜ ඀, Boolean ) +2168

Aspose.Pdf.Xml..(Pdf Ә, Section , ൜ ඀) +10287

Aspose.Pdf.Xml.ܣ.(Pdf Ә) +4038

Aspose.Pdf.Xml.᧹.᧾(؃ Է, Pdf Ә) +751

Aspose.Pdf.Pdf.Save(Stream stream) +550

MyPDFCreatorHelper.SaveAsPdfAndReturnLocationUsingFileStream(String full_path, String gwr_employee) +319

CreateCorrespondence.LoadGuidelinesData() +510

CreateCorrespondence.Page_Load(Object sender, EventArgs e) +428

System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15

System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33

System.Web.UI.Control.OnLoad(EventArgs e) +99

System.Web.UI.Control.LoadRecursive() +47

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

There was one other similar post (see below), which may help you guys:

Thanks in advance.

Jai

Hello Jai,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

As far as I can understand, you are using the conventional method of using Aspose.Pdf and Aspose.Words to convert a doc file into PDF. We know that, if the input .doc file contains images, then during the process when Aspose.Words in transforming the contents of input word files into intermediate XML file, the images are stored over the location where XML file is being saved. And from your problem description, you have mentioned that the problem only occurs where the input file contains images.

For the sake of correction, please specify a folder path for images to be stored, to a location where your application has access. You can use the following code line to specify the path where to save the images exported from Word document.

[C#]

doc.SaveOptions.PdfExportImagesFolder = @"c:/Temp/";

Where doc is the Document class object holding the word input document.

In case it does not resolve your problem, please feel free to contact.

Hi Nayyer,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for getting back to me.

I think you mean:

doc.SaveOptions.ExportImagesFolder

And no that still threw the same error.

Here is what I have.. see if I’m doing anything else incorrect. I am using FileStream at the moment, but I was passing in the file path before and got the same error.

String temp_dir = Server.MapPath("~\\Temp\\{0}\\");

String temp_xml_file = String.Format("{0}temp.xml", temp_dir);

System.IO.FileStream fs = new System.IO.FileStream(temp_output_file, System.IO.FileMode.Create );

// New a Doc object.

Document doc = new Document(full_path);

doc.SaveOptions.ExportImagesFolder = temp_dir;

// Save the doc in a xml fille that can be handled by Aspose.Pdf.

doc.Save(temp_xml_file, SaveFormat.AsposePdf);

// New a pdf object

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

// Bind content from the named xml file

pdf.BindXML(temp_xml_file, null);

//Instruct to delete temporary image files.

pdf.IsImagesInXmlDeleteNeeded = true;

// Save the result

pdf.Save(fs);

fs.Flush();

fs.Close();

Thanks in advance

Jai

Hi Nayyer,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Just to add to the above. The variable temp_dir will contain the following string, “\\nasserver\websitedir \Temp\”, after this link is executed

String temp_dir = Server.MapPath("~\\Temp\\{0}\\");

So it’s not an absolute path. We cannot have it because we are on a NAS device.

Thanks

Jai

i am also having the same issue, but i am trying to access the file from network, that is the only difference...

my network path is \\pmo1\Generate

Server Error in '/Web_PDFConverter' Application.
________________________________________
Logon failure: unknown user name or bad password.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Logon failure: unknown user name or bad password.

Line 51: Document doc = new Document(Result);
Line 52: string docFileName = doc.OriginalFileName.ToString().Replace(".docx", ".doc");
Line 53: doc.Save(docFileName, SaveFormat.Doc);

Hello sojan,

Thanks for considering Aspose.

Can you please share the complete stack trace information along with the code that you are using to convert the word document into PDF format, so that we can look into the details of this problem and see what might be causing an issue.

We apologize for your inconvenience.

Hi,

Even we face the same issue, when we try reading the pdf from the network shared folder and converting to tiff format. Could you please help us on this issue ASAP as we have deployment tomorrow.

Thanks

Hi Priya,


Sorry for the delayed response.

I have tested the scenario using Aspose.Pdf for .NET 7.5.0 over Windows 7 X64 where on my machine I am logged with a user who has access to folder shared over network and during my testing, I am unable to notice any issue while converting PDF pages into TIFF format. I have used the code snippet shared over following link Convert all PDF pages to single TIFF Image

We apologize for your inconvenience.