Document Id is 0

Sep 5, 2008 at 7:40 PM
Edited Sep 5, 2008 at 7:41 PM
Hi I have created a c# class called ScripdUtil which makes all the scripd API calls and in the constructor of that class i set the following

Service

.APIKey = "*************";

 

 

Service.SecretKey = "**************";

 

 

Service.EnforceSigning = true;

 

 

Service.PublisherID = "************************";

 

 

User.Login("*********", "*************");

Then I have a method in that class like this

 

public

int UploadDocument(string filePath)

 

 {

 

 

Document doc = Document.Upload(filePath, AccessTypes.Private);

 

 

return doc.DocumentId;

 

 }

I always get the documentId as 0 and I do not get any errors as well. I am calling this method from a aspx code behind page on click or a button. Please advise.

 

 

Coordinator
Sep 8, 2008 at 6:56 PM
I'm not sure what to tell you - I've not really tested this with ASP.NET so there may be a "timing" issue.

I've got some documentation here on it's use here:

http://www.codeplex.com/scribdnet/Wiki/View.aspx?title=Scribd.Net.Document.Upload&referringTitle=Scribd.Net.Document
Sep 8, 2008 at 7:05 PM
I have got to a point where I can make it work this way:

protected

void Page_Load(object sender, EventArgs e)

 

{

 

Service.APIKey = "*************";

 

 

Service.SecretKey = "*****************";

 

 

Service.EnforceSigning = true;

 

Scribd.Net.

User.Login("**********", "**********");

 

 

Document doc = Document.Upload("c:\\Test.doc", "doc");

 

Response.Write(doc.DocumentId);

}

How ever this code returns me a documentId '0' if I run it from uner a virtual directory. If i run it from the default  'Visual Studio Development Server' I am able to upload the document fine and see a proper documentid. Can you please elaborate about the proxy ? I wonder if there is any other property i need to set up when running from the virtual directory ?

Coordinator
Sep 8, 2008 at 7:54 PM
Edited Sep 8, 2008 at 7:59 PM
Hm.

Ensure you can write to the directory;  The Upload process writes your file to a temporary directory (Path.GetTempFileName()), so it may be bombing there.  When you upload and get a DocumentID of 0, is the document showing up on Scribd.com? 

>> EDIT

Scratch that - that only happens if you give Upload() a stream.  I'll find some time tonight to try and reproduce your issue.

- Paul

Sep 8, 2008 at 7:58 PM
When the docId is 0, the document does not show up in Scribd.
Coordinator
Sep 8, 2008 at 8:03 PM
Ok - that's "good".  That means that you're not getting out (I really should throw an exception there, eh?)

The process opens up a .NET webclient instance, calls scribd.com, and posts the data.  There may be a restriction in that process in IIS.