null reference in my code

  • Thread starter Thread starter maha6242
  • Start date Start date
M

maha6242

Guest
public class MYDB : Controller
{

private string MyString;

public string MyProperty
{
get { return UserDataBaseInitalize(); }
}


public string UserDataBaseInitalize()
{
SchoolModels SH = new SchoolModels();

if (Session["IndependentSchool"] != null)
{
SH = (SchoolModels)Session["IndependentSchool"];

}
else
{
Response.Redirect("Welcome/Index");
}

return SH.SchoolDataBase;
}
}


when i call got the null reference user code

public AccountController(string db)
: this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext(new MYDB().MyProperty))))
{

}

Continue reading...
 
Back
Top