If you put the userId an a session variable, you can access that variable from every page. So let's say you have a "details.aspx" and a querystring telling tha page which user to show, the you can just check on page load that the user is logged in and that it is the correct user.
protected void Page_Load(object sender, EventArgs e)
{
var userIdToShow = Convert.ToInt32(Request.QueryString["UserId"]);
var userId = Convert.ToInt32(Session["UserId"]);
if(userId != userIdToShow)
{
Response.Redirect("Login.aspx");
}
}