Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You might do something similar..</p> <p>Modify your <code>web.config</code> file to send emails</p> <p>e.g. This use gmail settings</p> <pre><code> &lt;system.net&gt; &lt;mailSettings&gt; &lt;smtp from="yourMailId@gmail.com "&gt; &lt;network host="smtp.gmail.com" defaultCredentials="false" port="587" userName ="yourmail@gmail.com" password="yourpassword" /&gt; &lt;/smtp&gt; &lt;/mailSettings&gt; &lt;/system.net&gt; </code></pre> <p>And in your <code>page_load</code></p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { var user = HttpContext.Current.User; if (user != null &amp;&amp; user.Identity.IsAuthenticated) { var id = Membership.GetUser().ProviderUserKey; SendMail(id.ToString()); } } } public void SendMail(string id) { var message = new MailMessage(); message.IsBodyHtml = true; message.From = new MailAddress("yourmail"); message.To.Add(new MailAddress("tomail")); message.Subject= "user access page"; message.Body = "Your Message";// add id here var client = new SmtpClient(); client.Send(message); } </code></pre> <p>if you using <code>vb</code> try something like this.</p> <p>This way, you will not need to change your <code>web.config</code></p> <pre><code>Dim mailobject As New System.Net.Mail.MailMessage() Dim myCred As New System.Net.NetworkCredential("yourmail@gmail.com", "password") mailobject.To.Add("tomail") mailobject.Subject = "User Access The Page" mailobject.From = New System.Net.Mail.MailAddress("frommail") mailobject.IsBodyHtml = True mailobject.Body = "Your Message" Dim SmtpMail As New System.Net.Mail.SmtpClient("smtp.gmail.com") SmtpMail.UseDefaultCredentials = False SmtpMail.EnableSsl = True SmtpMail.Credentials = myCred SmtpMail.Port = 587 SmtpMail.Send(mailobject) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload