Exemplo n.º 1
0
        protected void Click_Authorized(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            int    id     = Convert.ToInt32(button.Attributes["data-id"]);

            uf.AuthorizeById(id, true);
            User            u    = uf.Get(id);
            EmailController ec   = new EmailController();
            string          body = string.Empty;

            using (StreamReader reader = new StreamReader(Server.MapPath("~/Email/AuthorisationEmail.html")))
            {
                body = reader.ReadToEnd();
            }
            string strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery;
            string strUrl          = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/");
            string lienActivation  = strUrl + "Connexion.aspx";

            body = body.Replace("{lienConnexion}", lienActivation);
            ec.SendMail(u.email, "Cabinet Jean-Marc Guay", body);
            Response.Redirect(Request.RawUrl);
        }