Unauthorised (401) error in PDS

M

Mandarb

Hi

I get 401 Unauthorised error when I try to log on to Project Server with PDS
.. I am using Project Server authentication, and it only happens when a clien
t tries to connect to the comuter with the client on. I am using a ASP.Net p
age to connect to a project server. So it would be client -> ASP.Net server
-> Project Server.

Most of the similar posts deal with integrated authentication, but not Proje
ct Server authentication.

here is the code I am using:

code:--------------------------------------------------------------------------------
if(sCookie != "") return 1;
string sURL;

sURL = this.URL + "/LgnPsAu.asp";
sURL = sURL + "?un=" + this.UserName + "&pwd=" + this.Password ;


HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(sURL);
CookieContainer conCookie = new CookieContainer();
myReq.CookieContainer = conCookie;
myReq.Credentials = CredentialCache.DefaultCredentials;

//This line of code is necessary in order to work with SSL enabled
// Project Server sites - see the SSL Certificate Handling Class below.
ServicePointManager.CertificatePolicy = new MyCertificateValidation();

// Return the response.
try
{
HttpWebResponse myRes = (HttpWebResponse)myReq.GetResponse();
XmlDocument XMLDoc = new XmlDocument();
XMLDoc.Load(myRes.GetResponseStream());
// Close the response to free resources.
myRes.Close();
sCookie = GetLogonStatus(XMLDoc);
if(sCookie.Length < 10)
{
sCookie = "";
throw new Exception("Microsoft Project Server logon failed.\nLogon Stat
us = " + sCookie);
}
}
catch (WebException ex)
{
string mess;
if(ex.Response == null)
{
mess = "Logon Exception Occurred\n" + ex.Message;
}
else
{
mess = "Logon Exception Occurred\n" + ex.Message + "\n" + ex.Response.R
esponseUri.AbsoluteUri;
}
throw new Exception (mess);

}
return
1;--------------------------------------------------------------------------------

This also happens with integrated authentication
Any help would be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top