PDA

View Full Version : سوال: مشکل در ایجاد متد برای موجود بودن session



elnaz_sh
چهارشنبه 21 اردیبهشت 1390, 21:06 عصر
با سلام
یک متد به نام exists در یه کلاسی به اسم userprofile نوشتم برای بررسی موجود بودن session


publicstaticbool Exists(string name, System.Collections.Specialized.
NameObjectCollectionBase.KeysCollection keys)
{
foreach (string s in keys)
{
if (name == s)
{
returntrue;
}
returnfalse;
}
}



برای اینکه کاربر نتواند بدون لاگین وارد شود در لود صفحه نوشتم


if (!UserProfile.Exists("letlogin",Session.Keys))
{
Response.Redirect("login.aspx");
}
else
{


error زیرا میده

System.Collections.Specialized.NameObjectCollectio nBase.KeysCollection)': not all code paths return a

لطفا هر کی میدونه جواب بده