This project is read-only.

ERROR : '650 Invalid parameter value'

Dec 17, 2008 at 5:46 AM
I am facing a typical problem.
I am able to upload a file into Scribd using Scribd.Net thru ASP.Net Development Server, but when I host the same in a webserver I get "650 Invalid parameter value" error.
Please Help.
Coordinator
Dec 18, 2008 at 2:48 AM
Pinakee,

Can you provide the code snippet of your call so I can attempt to recreate it?

Thanks -
- Paul
Dec 18, 2008 at 9:22 AM
Edited Dec 18, 2008 at 9:26 AM
Paul,
       I have pasted the Default.aspx and Default.aspx.cs contents for your reference.
       If any special configuration needed for the IIS ( I am using IIS 6.0 on Windows 2003 Server), please let me know.



DEFAULT.ASPX :

<%@ Page Language="C#" AutoEventWireup="true" Debug="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <br />
        <asp:Button ID="cmdUpload" runat="server" onclick="cmdUpload_Click" Text="Upload" />
        <br />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:Label ID="lblShowPerc" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
    </div>
    </form>
</body>
</html>

DEFAULT.ASPX.CS:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Scribd.Net;

public partial class _Default : System.Web.UI.Page
{
    private string _title = "";
    private EventHandler<UserEventArgs> _loggedInHandler;
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Label1.Text="";
        LoadLoginSettings();
        InitializeScribdEventHandlers();
        _loggedInHandler = new EventHandler<UserEventArgs>(User_LoggedIn);
        this.TextBox1.Visible = false;
    }
    private void InitializeScribdEventHandlers()
    {
        Document.Uploaded += new EventHandler<DocumentEventArgs>(Document_Uploaded);
        Document.Saved += new EventHandler<DocumentEventArgs>(Document_Saved);
        Document.UploadProgressChanged += new EventHandler<System.Net.UploadProgressChangedEventArgs>(Document_UploadProgressChanged);
        Service.Error += new EventHandler<ScribdEventArgs>(Service_Error);
    }
    private void ShowError(string msg)
    {
        this.Label1.Text = msg;
    }

    // Scribd Error Handler
    void Service_Error(object sender, ScribdEventArgs e)
    {
        ShowError("Scribd Error: " + e.ErrorCode.ToString() + e.Message);
    }

    private void LoadLoginSettings()
    {
        try
        {
            Service.APIKey = "XXXXXXXX";
            Service.SecretKey = "XXXXXXXXXXX";
            Service.EnforceSigning = true;
            Service.PublisherID = "XXXXXXXX";  // Optional
            LoginUser("XXXX", "XXXXXXX");   
        }
        catch (Exception Ex)
        {
           ShowError("Scribd Error: " + Ex.Message);
        }
    }

    void LoginUser(string user, string password)
    {
        // Subscribe to events
        Scribd.Net.User.LoggedIn += _loggedInHandler;
        Scribd.Net.User.LoginFailed += _loggedInHandler;
        // Sign into the service
        bool signInResult = Scribd.Net.User.Login(user, password);
        Session["signedin"] =signInResult.ToString();
        if (signInResult)
        {
            
        }
        else
        {
           
        }
    }

    void User_LoggedIn(object sender, UserEventArgs e)
    {
        Scribd.Net.User.LoggedIn -= _loggedInHandler;
        Scribd.Net.User.LoginFailed -= _loggedInHandler;
        if (e.Success)
        {
            
        }
        else
        {
            
        }
    }
    protected void cmdUpload_Click(object sender, EventArgs e)
    {
        String str01;
        str01 = this.FileUpload1.PostedFile.FileName;
        this.TextBox1.Visible = false;
        String fName = str01;
        String fExt = System.IO.Path.GetExtension(str01);
        _title = System.IO.Path.GetFileNameWithoutExtension(str01);
        UploadDocumentToScribd(fName, true);
    }
    private void PrepareGUIForUpload()
    {
        this.Label1.Text = "Uploading document to Scribd";
        this.TextBox1.Visible = false;
    }
    private void UploadDocumentToScribd(string filename, bool isPrivate)
    {
        PrepareGUIForUpload();
        UploadFileToScribd(filename, GetScribdAccessType(isPrivate));
    }

    private AccessTypes GetScribdAccessType(bool isPrivate)
    {
        return ((isPrivate) ? AccessTypes.Private : AccessTypes.Public);
    }

    private void UploadFileToScribd(string filename, AccessTypes accessType)
    {
        try
        {
            Scribd.Net.Document.Upload(filename, accessType);
        }
        catch (Exception _ex)
        {
            Response.Write(_ex.ToString());
        }
     }


    //Called by Scribd API to show progress
    void Document_UploadProgressChanged(object sender, System.Net.UploadProgressChangedEventArgs e)
    {
      
    }

    void Document_Saved(object sender, DocumentEventArgs e)
    {
        this.TextBox1.Text = e.Document.GetEmbedCode();
        ShowSaveAndUploadFinished();
    }

    private void ShowSaveAndUploadFinished()
    {
        this.TextBox1.Visible = true;
        this.Label1.Text = "Document uploaded to Scribd";
    }

    // Called by Scribd API when the document is uploaded
    void Document_Uploaded(object sender, DocumentEventArgs e)
    {
        if (e.Document != null)
        {
            e.Document.Title = _title;
            e.Document.Save();
        }
    }
}



Coordinator
Dec 18, 2008 at 3:24 PM
Hm.  That is a Scribd.com API error.  Let me make sure I'm passing all the necessary params to the call in the code.  (I recently changed the way it uploads files to Scribd to handle larger file sizes).

- Paul
Dec 19, 2008 at 9:32 AM
Paul,
      I have used the 2008.12.7.0 of Scribd.Net.dll and the DemoWebSite that is provided in the latest build.
      Can you please provide a code snippet where I can upload a file as PRIVATE to Scribd with the FILENAME without EXTENSION as Title and get the URL of the file for my reference.
Coordinator
Dec 19, 2008 at 7:05 PM
Pinakee,

This works for me:

public sub UploadMyFile()
{
    string _fileName = FileUpload1.PostedFile.FileName;
    string _title = System.IO.Path.GetFileNameWithoutExtension(_fileName);
    Scribd.Net.Document _document = Scribd.Net.Document.Upload(_fileName, Scribd.Net.AccessTypes.Private);
    _document.Title = _title;
    _document.Save()
}

In your code,

// Called by Scribd API when the document is uploaded
    void Document_Uploaded(object sender, DocumentEventArgs e)
    {
        if (e.Document != null)
        {
            e.Document.Title = _title;
            e.Document.Save();
        }
    }


You need to ensure that you have a document id or it will bomb.

- Paul
Dec 23, 2008 at 4:52 AM
Edited Dec 30, 2008 at 8:11 AM
Paul,

The above code of Default.aspx.cs works fine for me in ASP.Net Development Server of VS 2008. I am able to upload to Scribd, without any modification.

But, when I put that in a PC (Windows 2003 Server) having IIS 6.0, it is giving the
"650 Invalid parameter value" error.

So, I hope there is something missing in the IIS configuration which is not allowing the operation.

Can I get some help from you in this regard ?

-Pinakee
Apr 13, 2011 at 12:35 AM

Hi Paul, Hi pinakee this code is Pinakee and tried to fix it but I get this error, I am using Scribd 3.5. excuse my writing does not speak or write English, speak Spanish.
the code is as follows:

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="cmdUpload" runat="server" onclick="cmdUpload_Click" Text="Upload" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<asp:Label ID="lblShowPerc" runat="server"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
</div>

</form>
</body>
</html>

 

 

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Scribd.Net;

public partial class Default2 : System.Web.UI.Page
{
private string _title = "";
private EventHandler<UserEventArgs> _loggedInHandler;
protected void Page_Load(object sender, EventArgs e)
{
this.Label1.Text = "";
LoadLoginSettings();
InitializeScribdEventHandlers();
_loggedInHandler = new EventHandler<UserEventArgs>(User_LoggedIn);
this.TextBox1.Visible = false;
}

private void LoadLoginSettings()
{
try
{
Service.APIKey = "xxxxxxx";
Service.SecretKey = "xxxxxx";
Service.EnforceSigning = true;
Service.PublisherID = "xxxxxx"; // Optional
LoginUser("xxxxx", "xxxxxx");
}
catch (Exception Ex)
{
ShowError("Scribd Error: " + Ex.Message);
}
}

void LoginUser(string user, string password)
{
// Subscribe to events
Scribd.Net.User.LoggedIn += _loggedInHandler;
Scribd.Net.User.LoginFailed += _loggedInHandler;
// Sign into the service
bool signInResult = Scribd.Net.User.Login(user, password);
Session["signedin"] = signInResult.ToString();
if (signInResult == true)
{
this.Label1.Text = "1";
}
else
{
this.Label1.Text = "0";
}
}

private void InitializeScribdEventHandlers()
{
Document.Uploaded += new EventHandler<DocumentEventArgs>(Document_Uploaded);
Document.Saved += new EventHandler<DocumentEventArgs>(Document_Saved);
Document.UploadProgressChanged += new EventHandler<System.Net.UploadProgressChangedEventArgs>(Document_UploadProgressChanged);
Service.Error += new EventHandler<ScribdEventArgs>(Service_Error);
}

void Document_Uploaded(object sender, DocumentEventArgs e)
{
if (e.Document != null)
{
e.Document.Title = _title;
e.Document.Save();
}
}

void Document_Saved(object sender, DocumentEventArgs e)
{
this.TextBox1.Text = e.Document.GetEmbedCode();
ShowSaveAndUploadFinished();
}

private void ShowError(string msg)
{
this.Label1.Text = msg;
}

Coordinator
Apr 15, 2011 at 3:36 AM

Hi.

Take a look here:  https://drupal.org/node/735126 

It appears this is on the Scribd.com side of things and not with this Client Library.

- P