Geeks With Blogs
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

To check for user authentication and session expiry

On POPUP PAGE

Call this function on Pageload.

IsUserAuthorizedinPopUp(Convert.ToString(Session["UserId"]));

/// <summary>
    /// To check for user authentication and session expiry
    /// </summary>
    /// <param name="userId"></param>
    /// <returns></returns>

    public bool IsUserAuthorizedinPopUp(string userId)

    {
        bool continueFlag = false;

        if ((userId == "") || (userId == "0"))
        {
           RadAjaxPanel1.ResponseScripts.Add("CancelEdit();");

        }

        else
        {

            continueFlag = true;
        }

        return continueFlag;

    }

On Nornal page (defined in pagebase)
Call this function on Pageload.

 

IsUserAuthorized(Convert.ToString(Session["UserId"]));

/*'----------------------------------------------------------------

        ' Function Name     : IsPublicUserAuthorized
        ' Purpose           : This method checks authentication for the Public users
        ' Input             : userId as String
        ' return output     : True if authorized user else False
        '----------------------------------------------------------------*/

        public bool IsUserAuthorized(string userId)

        {

             /* Disable client-side caching of web pages such that Browser Back/Forward button usage does

            ' not cause any issues*/

            bool continueFlag=false;

            DisableBrowserBack();

            if ((userId == "") || (userId == "0"))

            {

                 Response.Redirect("TIOLogin.aspx");

            }
            else
            {

                continueFlag =true;

            }
            return continueFlag;

        }

Posted on Thursday, April 3, 2008 7:03 PM Vini | Back to top


Comments on this post: check for user authentication and session expiry

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Gaurav Taneja | Powered by: GeeksWithBlogs.net