我正在使用a NameValueCollection发布到网站.转换为字符串时的响应数组包含" \r\n".我需要纯HTML,所以我可以使用字符串来显示页面上的内容.这是代码:
byte[] responseArray = myWebClient.UploadValues(SubmitURL, myNameValueCollection);
string s = Encoding.ASCII.GetString(responseArray);
Run Code Online (Sandbox Code Playgroud)
s包含这样的东西:
\r\n \r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\r\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n\r\n<head>\r\n<title>Transaction Code Search Results</title>\r\n<link href=\"searchreference.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n\r\n</head>\r\n\r\n<body topmargin=\"10\" leftmargin=\"10\">\r\n<table border=\"0\" width=\"100%\">\r\n <tr>\r\n <td width=\"70\" rowspan=\"2\" align=\"left\"><img src=\"images/WFLogo_62.gif\" alt=\"WF logo\" width=\"62\" height=\"62\" /></td>\r\n <td height=\"40\"> </td>\r\n <td rowspan=\"2\"><form method=\"post\" action=\"trancodesearch3.asp\">\r\n <div align=\"right\">\r\n <input type=\"submit\" name=\"Search again\"\r\n value=\"Search again\" />\r\n </div>\r\n </form></td>\r\n </tr>\r\n <tr>\r\n <td valign=\"bottom\"><h1>Transaction Code Search Results</h1></td>\r\n </tr>\r\n</table>\r\n\r\n<hr size=\"1\" class=\"redline\" />\r\n\r\n<table width=\"100%\" border=\"0\" align=\"
left\" cellpadding=\"6\"
Run Code Online (Sandbox Code Playgroud) If I want to sell my ebook online, and want to make sure the buyer can not redistribute my ebook, how can I secure it?
我有以下代码:
if (user.ReAccess == 1 || user.CetAccess == 1)
{
}
else
{
//Do Something
}
Run Code Online (Sandbox Code Playgroud)
但是,理想情况下我想做这样的事情(如果没有).但这有语法错误.
if !(user.ReAccess == 1 || user.CetAccess == 1)
{
//Do Something
}
Run Code Online (Sandbox Code Playgroud) 我收到编译器错误
CS1061“MAUserVM”不包含“GetAwaiter”的定义,并且找不到接受“MAUserVM”类型的第一个参数的可访问扩展方法“GetAwaiter”(您是否缺少 using 指令或程序集引用?)
异步方法
public class MAUserVM
{
public string AuthenticationStatus;
public MAUser mAUser;
public async Task<MAUserVM> GetMAUserAsync(string Email, string Password, IConfiguration configuration, IHttpContextAccessor accessor)
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
调用方法
private async Task<Boolean> AuthenticateUser(string email, string password)
{
...
// exception happening here
userVM = await userVM.GetMAUserAsync(email, password, _configuration, _accessor).Result;
...
}
Run Code Online (Sandbox Code Playgroud)
是什么原因造成的?