This project is read-only.

Signing up a new user

Mar 11, 2008 at 3:13 AM
Edited Mar 11, 2008 at 3:16 AM
I've got some problems implementing the API..

To start with I cannot sign up a new user, this is the code that I run:

private string APIKey = "xxx";
private string SecretKey = "xxx";
private string PublisherID = "xxx";

private string username = "username";
private string password = "password";
private string email = "";
private string name = "name";

protected void Page_Load(object sender, EventArgs e)
Scribd.Net.Service.APIKey = APIKey;
Scribd.Net.Service.SecretKey = SecretKey;
Scribd.Net.Service.EnforceSigning = true;
Scribd.Net.Service.PublisherID = PublisherID;

Scribd.Net.User.Signup(username, password, email, name);

When I get to Scribd.Net.User.Signup I get a System.NullReferenceException. The stack trace looks like this:

NullReferenceException: Object reference not set to an instance of an object.
System.Xml.XmlNode.set_InnerText(String value) +114
Scribd.Net.Response.Dispose() +51
Scribd.Net.User.Signup(String userName, String password, String email, String name) +1011
ScribdDefault.PageLoad(Object sender, EventArgs e) in c:\pwxtime\pwxtime\Scribd\Default.aspx.cs:31
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3036

I'm trying to run this code locally on my computer in VS2005 if it makes any difference.
Mar 11, 2008 at 2:15 PM
Edited Mar 11, 2008 at 2:45 PM
I don't know if it matters that you're using VS2005, but to be sure it needs to be running with the .NET 3.0 library. You're using the library correctly.

This is a bug in the Scripd.Net.Response.Dispose() method.

The release, [release:11409], contains this bug, however the source code has this corrected.

I should also note that if you attempt to sign up the same user (using the same email address), you will receive an error from Scribd. (I know this makes it increasingly difficult to test your code.)

Please let me know what you're using the library for - I'd love to see it!

This has been corrected in the [release:11412] release.

Mar 12, 2008 at 5:57 AM
thanks for the update!

I'm working on a social network that hasn't yet been released. We want users to be able to upload documents and share them with their friends and family on our site and since the site is written in ASP.NET this library is really nice to have! (if I ever get it to work :) )

So a quick question, when I run the code with the new code I don't get the System.NullReferenceException anymore but I have no idea if the user is registered or not. Should I get an error if try to re-register a user?
Mar 12, 2008 at 6:09 PM
With the new release, the SignUp (as well as Login) method now returns a boolean indicating success or failure. One of the "gotchas" in the code is that the Scribd.Net.Service.User is set to the newly signed up user. I'm toying with the idea of modifying this - what do you think?
Mar 12, 2008 at 7:07 PM
Please check out the latest release, [release:11612]. For a good way to handle the sign up process, check out the usage example in Scribd.Net.User.Signup. Note that the login process still performs the same way.
Apr 1, 2008 at 9:57 AM
Hi again!

Haven't had time too look at it for a while. Anyways.. your sample code fails for me. The signup function return false all the time. Is there anyway to get a more detaild error message or don't scribd support those?
Apr 3, 2008 at 7:07 AM
My bad, made a silly misstake. It works brilliantly!