PDS returning unauthorized error instead of xml response.

D

Donal

I have an aspx page with code behind in c#.

I am trying to get to grips with the PDS response.
If I use
LgnPsAu.asp and pass an incorrect username/password. I get an xml
result indication so. If i pass a correct username and password,
however, I get a 401 Unauthorized error, not an xml response. I am
using the Project Server administrator (not the domain one) as the
user.

I also get a 401 error if i try and use integrated authentication.

Can someone explain this to me?

Code snippet below.

Cheers


....
sURL = "http://server/projectserver/LgnPsAu.asp?un=person&pwd=password";
//Balks at next line with 401 error if username and password is ok!
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(sURL);
CookieContainer conCookie = new CookieContainer();
myReq.CookieContainer = conCookie;
myReq.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse myRes = (HttpWebResponse)myReq.GetResponse();
XmlDocument XMLDoc = new XmlDocument();
XMLDoc.Load(myRes.GetResponseStream());
Response.Write(XMLDoc.InnerXml);
myRes.Close();
....
 
D

David Gage - Project MVP

Check out the following article and see if it helps you any.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/pdr/PDR_Programmatic_logon_3325.asp

However, I suspect that the issue you are running into might be one of IIS
user authentication. I would try to keep it simple first which means to run
this code on your TEST Project Server logged in with administrator rights.
If that works then you do indeed have a permissions issue related to IIS or
access to the PDS dll.

You might also want to take a look at the PDS Test.NET utility which comes
with source code.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/pdr/PDR_Using_PDS_3369.asp
 
D

Donal

I moved my code over to the Project Server box and it runs fine. i.e.
it returns the authentication cookie if i pass a username and pw in
the query.

So what is preventing this from running on a different machine?

Any ideas?
 
L

Lars Hammarberg

Did you run this against the ProjectServer box when the error appeared?
Or did you run this against a test website created by copying the IIS
Virtual Root from the original projectserver installation? (...as I did....)
If the latter - you have to edit the soap schema file pds.wsdl in the "Copy
of IIS Virtual Root" folder to point to the correct website - i.e.; check
the <soap:address location=... tag at the end of the file.

/Lars Hammarberg
www.camako.se
 
D

Donal

I was running this on my local machine and pointing it to
http://server/projectsever.

I moved my code onto the project server machine, and now at least I
can get the expected response.

However,
I am unable to connect via integrated authentiction. I can conenct I
pass credentials ok.

Frustrated...
 
D

Donal

ok.

The reason it would not work, it would appear, was because I had IE
prompt for username and password. When i set to use current username
and password, it worked past the 401 error.

Now I can run the aspx on my local machine and integrated
authentication (LgnIntAu.asp) will return the cookie. But When I run
same code on project server, it returns a 5003 (NoLogonUSer).

I return the LOGON_USER server variable, and it returns my domain
username correctly.
 

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