我有这个个人资料编辑页面,但是如果用户更改了 url 中的 id,他可以更改其他用户的个人资料,我如何拒绝访问 url 中的其他 id
if (!IsPost)
{
//if(!Request.QueryString["ID"].IsEmpty()){
if (!Request.QueryString["UserId"].IsEmpty() && Request.QueryString["UserId"].IsInt())
{
UserId = Request.QueryString["UserId"];
var db = Database.Open("mystring");
var dbCommand = "SELECT * FROM UserProfile WHERE UserId = @0";
var row = db.QuerySingle(dbCommand, UserId);
if (row != null)
{
Email = row.Email;
fullname = row.fullname;
location = row.location;
}
else
{
ModelState.AddFormError("No Profile was selected.");
}