我在我的Web應用程序和Web服務中都有一個「用戶」類。如何通過Web服務檢索類?
一切正常,我找回數據,但是當我分配User類在我的Web應用程序的Web服務的話,就無法在兩個
我怎麼把它在我的web應用程序之間轉換
User user = new User();
user = userService.Login(UserName.Text, Password.Text); // Here it says it can't convert
如何從我的web服務
[WebMethod]
public User Login (string userName, string Password)
{
UserData usrData = new UserData();
return usrData.UserExists(userName, Password);
}
什麼我的課看起來像兩個Web App和Web服務發送
[Serializable]
public class User
{
/// <summary>
/// User Id
/// </summary>
public int ID { get; set; }
/// <summary>
/// User Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// User Surname
/// </summary>
public string Surname { get; set; }
/// <summary>
/// User Email
/// </summary>
public string Email { get; set; }
/// <summary>
/// User Password
/// </summary>
public string Password { get; set; }
}
這樣的事情如何:http://stackoverflow.com/questions/560722/asmx-web-service-expose-class? –