Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

working with whm api using c#.net

Discussion in 'cPanel Developers' started by sandeep p, Mar 19, 2016.

  1. sandeep p

    sandeep p Member

    Joined:
    Jun 25, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    bangalore
    cPanel Access Level:
    Root Administrator
    We tried to create an api interface using c#.net winforms but failed to login due 403 error
    code is attached for debugging

    Code:
      string url = "https://servername:2087/cpsess8074801816/xml-api/version";
    
      WebRequest wreq = WebRequest.Create(url);
    
      CredentialCache MyCredential = new CredentialCache();
      MyCredential.Add(new Uri("https://servername:2087/cpsess8074801816/xml-api/version"), "Basic", new NetworkCredential("root", "password"));
      wreq.Credentials = MyCredential;
       
      wreq.Timeout = 8000;
    
      WebResponse wres = wreq.GetResponse();
    
      if (((HttpWebResponse)wres).StatusDescription == "OK")
      {
      wres.Close();
      //  //Code if OK
      }
      else
      {
      wres.Close();
      //  //Code if not OK
      }
    
    
     
    #1 sandeep p, Mar 19, 2016
    Last edited by a moderator: Mar 19, 2016
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,720
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sandeep p

    sandeep p Member

    Joined:
    Jun 25, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    bangalore
    cPanel Access Level:
    Root Administrator
    Not Log Entry was Found..

    App Gave Error as : The remote server returned an error: (403) Forbidden.
     
  4. sandeep p

    sandeep p Member

    Joined:
    Jun 25, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    bangalore
    cPanel Access Level:
    Root Administrator
    Entry was not found in log at /usr/local/cpanel/logs/login_log
    webrequest returned 403 error
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,720
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. sandeep p

    sandeep p Member

    Joined:
    Jun 25, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    bangalore
    cPanel Access Level:
    Root Administrator
    issue resolved by creating additional layer to get session tokens
    thanks for all your support
     
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,720
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I am happy to see the issue is now resolved. Thank you for updating us with the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice