Search code examples
c#asp.nethidecode-behindinvisible

How can we hide (invisible) some CodeBehind lines (for example a class) from other developers in a common project?


How can we hide (invisible) some CodeBehind lines (for example a class) from other developers in a common project?

I asked this question because today we were working on email codes and we wanted to send an email to all of programmers emails therewith sending an Email to our common web site email.

How can we hide our passwords from each other?

Is it possible to make 3 classess (for sending emails to 3 web developers) and hide or invisible those classes(class file or codebehind lines) and so each peogrammer can see only his class?

thanks in advance///

the email code is like :

protected void Button1_Click(object sender, EventArgs e)
{

    //create mail message
    MailMessage mail = new MailMessage();
    //set the address
    mail.From = new MailAddress("Kazemipour@gmail.com");
    mail.To.Add("aaak@yahoo.com");
    //set the content
    mail.Subject = "Project email";
    mail.Body = "Hello World!";

    //send the message
    SmtpClient smtp = new SmtpClient();
    smtp.UseDefaultCredentials = false;
    smtp.Credentials = new System‎‎.Net‎‎.NetworkCredential("aaa@gmail.com", "pass");
    smtp.Host = "smtp.gmail.com";
    smtp.Port = 587;             
    smtp.EnableSsl = true;





    try
    {

        smtp.Send(mail);
        Button1.Text = "sent";
    }
    catch (System‎‎.Net.Mail.SmtpException exp)
    {
        Label1.Text = exp.ToString();
    }

}

Solution

  • I would suggest creating and using a service account, not your personal account, for sending email from a web site. If possible, have your mail system admins exempt this service account from requiring a password to send email. In my experience, admins are usually pretty good about making exceptions for lower risk service accounts (because it isn't used by any human for normal internet activity).