一。获取评论视频的id
if (!IsPostBack)
{
VideoId = Request.QueryString["id"];
var user = IdentityManager.ReadUser();
if (user == null)
{
Response.Redirect("~/login.aspx?ReturnUrl=" + Request.Url);
}
else if (string.IsNullOrWhiteSpace(VideoId))
{
Response.Redirect("~/Default.aspx");
}
NickName = user.NickName ?? $"用户{user.Id}";
Avatar = user.Avatar ?? "/imgs/avatar.jpg"
}
二。后端获取评论内容
public void ProcessRequest(HttpContext context)
{
var videoId = context.Request.QueryString["id"];
var discuss = new AiShow.Model.Discuss
{
Avatar = context.Request.Form["Avatar"],
Content = context.Request.Form["Content"],
NickName = context.Request.Form["NickName"],
ReplayTo=context.Request.Form["ReplayTo"],
AddTime=TimeHelper.GetTimeByUnix(long.Parse(context.Request.Form["AddTime"]))
};
IDiscussManager manager = new DiscussManager();
manager.Add(videoId,discuss);
context.Response.End();
}