Friday, September 12, 2008

Redirect user back to his previous page

Calling this funtion will redirect user to his last visited page after logging in.


protected void RequestLogin()
{
this.Response.Redirect(FormsAuthentication.LoginUrl +
"?ReturnUrl=" + this.Request.Url.PathAndQuery);
}

Get Base URL Snippet

public string BaseUrl
{
get
{
string url = this.Request.ApplicationPath;
if (url.EndsWith("/"))
return url;
else
return url + "/";
}
}

My Favorite Pic

GoogleDesktopPhotosPluginWallpaper