using System;
using System.Data;
using System.Data.Linq;
using System.Linq;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class main_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        if (user != null)
        {
            user_label.Text = "Prihlásený: " + user.UserName;
            NorthwindDataContext db = new NorthwindDataContext();
            photo fotka_path =
                (from f in db.photos
                 where f.user_name == user.UserName
                 select f).Single<photo>();
            user_image.ImageUrl = fotka_path.path;
            user_image.Width = 100;
            user_image.Height = 200;
        }
        else
        {
            Response.Redirect(@"~/login.aspx");
        }
    }
}
