p;This method removes some dangerous characters from the word to avoid ''Sql Injection attack''.
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string MakeSafeWord(string s)
{
if ( s == null )
return "";
return s.Replace("''", "").Replace("--", "");
}
/**//// <summary>
/// This method checks if the passed user id is an adinistrator or if this is same as current user.
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static bool IsOwner(object userId)
{
if ( System.Web.HttpContext.Current.Session["CurrentUser"] == null )
{
// There is no userid saved in session. This means user has not logged in.
return false;
}
// Get current user from session.
string currentUser = System.Web.HttpContext.Current.Session["CurrentUser"].ToString();
// Get the admin user id from config file.
string adminUser = System.Configuration.ConfigurationSettings.AppS