我不知道如何摆脱这个错误。我对 C# 很陌生,但请提供任何帮助。谢谢
错误:“ProjectServer.WebSvcLoginWindows”类型中不存在类型名称“LoginWindows”
源代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using ProjectServer.LoginForms;
using ProjectServer.Statusing;
using ProjectServer;
using System.Net;
using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;
using System.Windows.Forms.MessageBox;
using System.Windows.Forms;
namespace ProjectServer
{
public partial class LogonProjectServer : Form
{
public static WebSvcLoginWindows.LoginWindows loginWindows =
new WebSvcLoginWindows.LoginWindows();
public static CookieContainer cookies = new CookieContainer();
public static WebSvcProject.LoginForms loginForms =
new SyprisProjectServer.WebSvcProject.LoginForms();
private const string LOGINFORMSWEBSERVICE = "/PWA/_vti_bin/PSI/LoginForms.asmx?wsdl";
private const string LOGINWINDOWSWEBSERVICE = "/PWA/_vti_bin/PSI/LoginWindows.asmx?wsdl";
private string baseUrl; // Example: http://ServerName/ProjectServer/
public bool LogonPS(bool useWinLogon, string baseUrl,
string userName, string password)
{
const string LOGINWINDOWS = "PWA/_vti_bin/PSI/LoginWindows.asmx?wsdl";
const string LOGINFORMS = "PWA/_vti_bin/PSI/LoginForms.asmx?wsdl";
bool logonSucceeded = false;
try
{
if (useWinLogon)
{
loginWindows.Url = baseUrl + LOGINWINDOWS;
loginWindows.Credentials = CredentialCache.DefaultCredentials;
if (loginWindows.Login()) logonSucceeded = true;
}
}
// Catch statements
catch (System.Web.Services.Protocols.SoapException ex)
{
MessageBox.Show(ex.Message.ToString(), "Logon Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (System.Net.WebException ex)
{
MessageBox.Show(ex.Message.ToString(), "Logon Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return logonSucceeded;
}
}
}