protected void SaveName(object sender, EventArgs e)
    {
        if (hf_ss_page_id.Value != String.Empty)
        {
            String name = tb_name.Text.Trim();
            if (name != "jptest")
            {
                if (String.IsNullOrEmpty(name))
                {
                    SmartSocialUtil.PageMessageAlertify(this, GetTranslationFromEnglish("Please provide your name before you view this SMARTsocial profile."), GetTranslationFromEnglish("Your Name is Required"));
                }
                else if (name.Length > 200)
                {
                    SmartSocialUtil.PageMessageAlertify(this, GetTranslationFromEnglish("Your name must be less than 200 characters"), GetTranslationFromEnglish("Name Too Long"));
                }
                else
                {
                    Session["name"] = name;
                    SmartSocialUtil.AddActivityEntry("View");

                    // Generate and save a cookie for this user
                    SaveViewCookie();

                    SmartSocialUtil.CloseRadWindow(this, name, false);
                }
            }
            else
            {
                SaveViewCookie();
                SmartSocialUtil.CloseRadWindow(this, name, false);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["SSid"] != null && Session["SSParamid"] != null)
            {
                hf_ss_page_id.Value       = Session["SSid"].ToString();
                hf_ss_page_param_id.Value = Session["SSParamid"].ToString();
                //Page.SetFocus(tb_name);

                SetPageLanguage();
            }
            else
            {
                SmartSocialUtil.CloseRadWindow(this, String.Empty, false);
            }
        }
    }
    public static void SendExceptionMail(HttpContext c, Exception ex)
    {
        String user_name = c.User.Identity.Name;

        if (user_name == String.Empty)
        {
            user_name = "Unknown user";
        }
        String inner = "No inner exception" + Environment.NewLine + Environment.NewLine;

        if (ex.InnerException != null)
        {
            inner = "Exception InnerException: " + ex.InnerException
                    + Environment.NewLine + Environment.NewLine
                    + "Exception InnerException Message: " + ex.InnerException.Message
                    + Environment.NewLine + Environment.NewLine
                    + "Exception InnerException StackTrace: " + ex.InnerException.StackTrace
                    + Environment.NewLine + Environment.NewLine;
        }
        String exception_msg =
            "---------------------- GLOBAL ERROR ---------------------------------"
            + Environment.NewLine
            + "----------------------------  EXCEPTION INFORMATION  -----------------------------"
            + Environment.NewLine
            + "An error occured at " + DateTime.Now + ". Generated by " + user_name + "."
            + Environment.NewLine + Environment.NewLine
            + "Exception: " + ex
            + Environment.NewLine + Environment.NewLine
            + "Exception Message: " + ex.Message
            + Environment.NewLine + Environment.NewLine
            + "Exception Type: " + ex.GetType()
            + Environment.NewLine + Environment.NewLine
            + "Stack Trace: " + ex.StackTrace
            + Environment.NewLine + Environment.NewLine
            + "Exception Data: " + ex.Data
            + Environment.NewLine + Environment.NewLine
            + "Exception Source: " + ex.Source
            + Environment.NewLine + Environment.NewLine
            + "Exception TargetSite: " + ex.TargetSite
            + Environment.NewLine + Environment.NewLine
            + inner
            + "-----------------------------  REQUEST INFORMATION  -------------------------------"
            + Environment.NewLine
            + "Request URL: " + c.Request.Url
            + Environment.NewLine
            + "Request RawURL: " + c.Request.RawUrl
            + Environment.NewLine
            + "Request Path: " + c.Request.Path
            + Environment.NewLine
            + "Request AnonymousID: " + c.Request.AnonymousID
            + Environment.NewLine
            + "Request Browser: " + c.Request.Browser.Browser
            + Environment.NewLine
            + "Request IsAuthenticated: " + c.Request.IsAuthenticated
            + Environment.NewLine
            + "Request UserHostAddress: " + c.Request.UserHostAddress
            + Environment.NewLine
            + "-----------------------------------------------------------------------------------";

        SmartSocialUtil.Debug(exception_msg);
        c.Server.ClearError();

        // Send alert e-mail
        System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
        mail            = SmartSocialUtil.EnableSMTP(mail);
        mail.To         = exception_mail_recipients;
        mail.From       = "*****@*****.**";
        mail.Subject    = "*SmartSocial Exception*";
        mail.BodyFormat = System.Web.Mail.MailFormat.Html;
        mail.Body       =
            "<div style=\"font-family:Verdana; font-size:8pt; border:solid 1px red;\">"
            + "<b>" + user_name + "</b> has generated a SmartSocial exception on page:"
            + "<br/><br/>" + c.Request.Url.ToString()
            + "<br/><br/>" + HttpUtility.HtmlEncode(exception_msg).Replace(Environment.NewLine, "<br/>")
            + "<br/><br/>A full list of exception details can be found in <b>debug.txt</b> in the SmartSocial project root folder."
            + "</div>";

        System.Threading.ThreadPool.QueueUserWorkItem(delegate
        {
            try { System.Web.Mail.SmtpMail.Send(mail); }
            catch { }
        });
    }