我正在使用以下代码来验证用户在我的asp.net应用程序中使用ServiceStack基本身份验证提供程序并接收serration异常.如果有人解决了这个问题,请回答.谢谢.
我在我的asp.net应用程序中使用以下代码:
<asp:Button ID="btnAuth" runat="server" OnClick="btnAuth_Click" Text="Authenticate"/>
Run Code Online (Sandbox Code Playgroud)
我在代码隐藏文件中的clien.Post方法上收到异常.
protected void btnAuth_Click(object sender, EventArgs e)
{
try
{
var baseUrl = Request.Url.GetLeftPart(UriPartial.Authority) + "/api";
var client = new JsonServiceClient(baseUrl);
var authResponse = client.Post<AuthResponse>(new Auth { UserName = "admin", Password = "12345" });
if (authResponse.ResponseStatus.ErrorCode == null)
{
//Do Something here
}
}
catch (WebServiceException ex)
{
throw ex;
}
}
Run Code Online (Sandbox Code Playgroud)
Followin是我在clien.Post方法上收到的Exeception Detail :
[SerializationException: Type definitions should start with a '{', expecting serialized type 'AuthResponse', got string …
Run Code Online (Sandbox Code Playgroud)