Check that the definition of sLoginName is part of the page class definition, not in a subsidiary class, or a general class:
public partial class MyPage: System.Web.UI.Page
{
public string sLoginName = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
sLoginName = Session["username"].ToString();
}
}
If that doesn't fix it, copy and paste the actual error message and related info instead of paraphrasing it.