• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Net.NetworkCredential类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Net.NetworkCredential的典型用法代码示例。如果您正苦于以下问题:C# System.Net.NetworkCredential类的具体用法?C# System.Net.NetworkCredential怎么用?C# System.Net.NetworkCredential使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Net.NetworkCredential类属于命名空间,在下文中一共展示了System.Net.NetworkCredential类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: fileComplaint

        internal bool fileComplaint(string name, string pid, string msg)
        {
            MailMessage message = new MailMessage();
            try
            {
                string emailid = "[email protected]";
                string smsg1 = "<b>Purchase Id: </b>" + pid;
                string smsg2 = "<br><b>Name: </b>" + name;
                string smsg3 = "<br><b>Message: </b>" + msg;

                message.To.Add(new MailAddress(emailid));
                message.From = new MailAddress("[email protected]");

                message.Subject = "Complaint agianst Purchase Id = " + pid;
                message.Body = smsg1 + smsg2 + smsg3;
                message.IsBodyHtml = true;

                SmtpClient client = new SmtpClient();
                client.Port = 25; // Gmail works on this port 587
                client.Host = "smtp.net4india.com";
                System.Net.NetworkCredential nc = new System.Net.NetworkCredential("[email protected]", "nrmr#ps24");
                client.EnableSsl = false;
                client.UseDefaultCredentials = false;

                client.Credentials = nc;
                client.Send(message);
                return true;
            }
            catch (Exception ex)
            {
                return false;
                throw ex;
            }
        }
开发者ID:praanasol,项目名称:Project-buddha,代码行数:34,代码来源:SendComplaint.cs


示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strPost = CCLib.Common.Strings.GetFormString("post");
                if (strPost == "1" && Session["RegionAdminInfo"] != null)
                {
                    DataRow drAdminInfo = (DataRow)Session["RegionAdminInfo"];
                    //CCLib.Common.DataAccess.ExecuteDb("update RRS_Login_View set Agreement=1 where RegionId='" + drAdminInfo["RegionId"].ToString().Replace("'", "''") + "' and Password='" + drAdminInfo["Password"].ToString().Replace("'", "''") + "'");
                    //
                    this.strPassword = drAdminInfo["Password"].ToString().Replace("'", "''");
                    this.strRegionID = drAdminInfo["RegionId"].ToString();
                    this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
                    this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];

                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                    System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                    this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                    this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                    this.wsSLXIntegration.Credentials = userCredential;
                    this.wsSLXIntegration.PreAuthenticate = true;

                    this.cnnCC = new SqlConnection(this.strConnectionStringToCC);
                    if (this.cnnCC.State == ConnectionState.Closed)
                    {
                        this.cnnCC.Open();
                    }
                    this.trsCC = this.cnnCC.BeginTransaction();

                    this.objDistrictUserID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectDistrictUserID(this.strPassword, this.strRegionID));
                    this.strDistrictUserID = this.objDistrictUserID != null ? this.objDistrictUserID.ToString() : null;

                    this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateRRSUsers(this.strDistrictUserID), this.cnnCC, this.trsCC);
                    if (this.intReturnValue1 > 0)
                    {
                        this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateConRRSUsers(this.strDistrictUserID), this.strConnectionStringToSLX);
                        if (this.intReturnValue2 > 0)
                        {
                            this.trsCC.Commit();
                            this.ReleaseObjects();
                        }
                        else
                        {
                            this.trsCC.Rollback();
                            this.ReleaseObjects();
                        }
                    }
                    else
                    {
                        this.trsCC.Rollback();
                        this.ReleaseObjects();
                    }

                    //

                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Region/Home.aspx");

                }
            }
        }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:60,代码来源:Agreement.aspx.cs


示例3: SendAnEmail

        public void SendAnEmail()
        {
            try
            {
                MailMessage _message = new MailMessage();
                SmtpClient _smptClient = new SmtpClient();

                _message.Subject = _emailSubject;

                _message.Body = _emailBody;

                MailAddress _mailFrom = new MailAddress(_emailFrom,_emailFromFriendlyName);
            
                MailAddressCollection _mailTo = new MailAddressCollection();
                _mailTo.Add(_emailTo);

                _message.From = _mailFrom;
                _message.To.Add(new MailAddress(_emailTo,_emailToFriendlyName));

                System.Net.NetworkCredential _crens = new System.Net.NetworkCredential(
                    _smtpHostUserName,_smtpHostPassword);
                _smptClient.Host = _smtpHost;
                _smptClient.Credentials = _crens;


                _smptClient.Send(_message);
            }
            catch (Exception er)
            {
                Log("C:\\temp\\", "Error.log", er.ToString());
            }
        }
开发者ID:connecticutortho,项目名称:ct-ortho-repositories4,代码行数:32,代码来源:SendEmail.cs


示例4: FTP

        public FTP(string url, Dictionary<string, string> options)
        {
            //This can be made better by keeping a single ftp stream open,
            //unfortunately the .Net model does not allow this as the request is
            //bound to a single url (path+file).
            //
            //To fix this, a thirdparty FTP library is required,
            //this would also allow a fix for the FTP servers
            //that only support SSL during authentication, not during transfers
            //
            //If you have experience with a stable open source .Net FTP library,
            //please let the Duplicati authors know

            Uri u = new Uri(url);

            if (!string.IsNullOrEmpty(u.UserInfo))
            {
                m_userInfo = new System.Net.NetworkCredential();
                if (u.UserInfo.IndexOf(":") >= 0)
                {
                    m_userInfo.UserName = u.UserInfo.Substring(0, u.UserInfo.IndexOf(":"));
                    m_userInfo.Password = u.UserInfo.Substring(u.UserInfo.IndexOf(":") + 1);
                }
                else
                {
                    m_userInfo.UserName = u.UserInfo;
                    if (options.ContainsKey("ftp-password"))
                        m_userInfo.Password = options["ftp-password"];
                }
            }
            else
            {
                if (options.ContainsKey("ftp-username"))
                {
                    m_userInfo = new System.Net.NetworkCredential();
                    m_userInfo.UserName = options["ftp-username"];
                    if (options.ContainsKey("ftp-password"))
                        m_userInfo.Password = options["ftp-password"];
                }
            }

            m_url = url;
            if (!m_url.EndsWith("/"))
                m_url += "/";

            m_useSSL = Utility.Utility.ParseBoolOption(options, "use-ssl");

            m_listVerify = !Utility.Utility.ParseBoolOption(options, "disable-upload-verify");

            if (Utility.Utility.ParseBoolOption(options, "ftp-passive"))
            {
                m_defaultPassive = false;
                m_passive = true;
            }
            if (Utility.Utility.ParseBoolOption(options, "ftp-regular"))
            {
                m_defaultPassive = false;
                m_passive = false;
            }
        }
开发者ID:pacificIT,项目名称:Duplicati,代码行数:60,代码来源:FTPBackend.cs


示例5: SendEmail

        public static int SendEmail(string ToEmail, string fromEmail, string Subject, string Body, string SMTP, string Username, string Password)
        {
            try
            {
                MailMessage mailMessage = new MailMessage(new MailAddress(fromEmail), new MailAddress(ToEmail));
                System.Net.NetworkCredential SmtpUser = new System.Net.NetworkCredential(Username, Password);
                dynamic emailHeader = default(StringBuilder);
                StringBuilder emailFooter = new StringBuilder();

                //message body and subject property
                mailMessage.Subject = Subject;
                mailMessage.Body = emailHeader.ToString() + Body + emailFooter.ToString();
                mailMessage.IsBodyHtml = true;

                //create smtp client
                SmtpClient smtpMail = new SmtpClient();

                //assign smtp properties
                smtpMail.Host = SMTP;
                smtpMail.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtpMail.UseDefaultCredentials = false;
                smtpMail.Credentials = SmtpUser;

                //send mail
                smtpMail.Send(mailMessage);

                return 1;
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "SendEmail");
                return 0;
            }
        }
开发者ID:khilje125,项目名称:RabtNewsAdmin,代码行数:34,代码来源:BLLEmail.cs


示例6: SendNotification

        public static void SendNotification(string message, string[] to)
        {
            SmtpClient client = new SmtpClient();
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.EnableSsl = true;
            client.Host = "smtp.gmail.com";
            client.Port = 587;

            // setup Smtp authentication
            System.Net.NetworkCredential credentials =
                new System.Net.NetworkCredential(SystemMail, SystemMailPass);
            client.UseDefaultCredentials = false;
            client.Credentials = credentials;

            MailMessage msg = new MailMessage();
            msg.From = new MailAddress(SystemMail);
            foreach (var recipient in to)
            {
                msg.To.Add(new MailAddress(recipient));
            }
            msg.Subject = "Автоматическя система оповещений VoTak";
            msg.IsBodyHtml = true;
            msg.Body = string.Format("<html><head></head><body>{0}</body>", message);
            client.Send(msg);
        }
开发者ID:unrealdrake,项目名称:votak,代码行数:25,代码来源:MailingService.cs


示例7: ParseUserInfo

        public static System.Net.NetworkCredential ParseUserInfo(System.Uri uri)
        {
            if (uri == null || string.IsNullOrWhiteSpace(uri.UserInfo)) return null;

            System.Net.NetworkCredential result = null;

            //Split into tokens taking only 3 tokens max
            string[] parts = uri.UserInfo.Split(CredentialSplit, 3);

            //cache the length of the split
            int partsLength = parts.Length;

            //If there are atleast two tokens
            if (partsLength > 1)
            {
                //If there is a domain use it
                if (partsLength > 2)
                {
                    result = new System.Net.NetworkCredential(parts[0], parts[2], parts[1]);
                }
                else //Use the username and password. (optionally use the host as the domain)
                {
                    result = new System.Net.NetworkCredential(parts[0], parts[1]);//, uri.Host);
                }
            }//There was only one token?

            return result;
        }
开发者ID:qinpengit,项目名称:net7mma-111212,代码行数:28,代码来源:UriExtensions.cs


示例8: btnSend_Click

        private void btnSend_Click(object sender, EventArgs e)
        {
            string filename = Path.GetDirectoryName(Application.ExecutablePath);
            filename += "\\BugReport.txt";
            if (!File.Exists(filename)) return;
            if (!IsEmail(txtEmail.Text)) { MessageBox.Show("Use your email!", "Please..."); txtEmail.Focus(); return; }

            foreach (Control c in Controls) c.Enabled = false;

            //Meglio farlo con un thread separato

            System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
            mailClient.EnableSsl = true;

            System.Net.NetworkCredential cred = new System.Net.NetworkCredential(
                "username",
                "password");
            mailClient.Credentials = cred;
            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(txtEmail.Text, "[email protected]", AboutForm.Singleton.GetSoftwareKey(), "Email:" + txtEmail.Text + Environment.NewLine + "Note:" + Environment.NewLine + txtNote.Text);
            message.Attachments.Add(new System.Net.Mail.Attachment(filename));

            //mailClient.Send(message);

            Close();
        }
开发者ID:Zoadian,项目名称:md-config-tool,代码行数:25,代码来源:ReportErrorForm.cs


示例9: SendEmail

        public static void SendEmail(string toAddress, string subject, string message)
        {
            string host = ConfigurationManager.AppSettings["EmailServerHost"];
            int port = Convert.ToInt32(ConfigurationManager.AppSettings["EmailServerPort"]);
            string domain = ConfigurationManager.AppSettings["EmailServerDomain"];
            string username = ConfigurationManager.AppSettings["EmailServerUsername"];
            string password = ConfigurationManager.AppSettings["EmailServerPassword"];
            string fromEmailAddress = ConfigurationManager.AppSettings["EmailFromAddress"];

            MailMessage mailMessage = new MailMessage(fromEmailAddress, toAddress);
            mailMessage.Subject = subject;
            //string queryString = "apkey=" + Convert.ToString(2);

            mailMessage.Body = message;
            mailMessage.IsBodyHtml = false;

            System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential(username, password, domain);

            SmtpClient smtpClient = new SmtpClient();
            smtpClient.Host = host;
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtpClient.Port = port;
            smtpClient.UseDefaultCredentials = false;
            smtpClient.Credentials = networkCredential;

            smtpClient.Send(mailMessage);
        }
开发者ID:udelblue,项目名称:SOA_Email_Service,代码行数:27,代码来源:Manager.cs


示例10: send_mail_gmail

        public static bool send_mail_gmail(string gmail_sender_account, string gmail_sender_pass, string sender_name, string sender_email, string receiver_name, string receiver_email, string subject, string body_content)
        {
            bool flag = false;
            System.Net.NetworkCredential smtp_user_info = new System.Net.NetworkCredential(gmail_sender_account, gmail_sender_pass);

            System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage();
            mailMessage.From = new System.Net.Mail.MailAddress(sender_email, sender_name, System.Text.UTF8Encoding.UTF8);
            mailMessage.To.Add(new System.Net.Mail.MailAddress(receiver_email, receiver_name.Trim(), System.Text.UTF8Encoding.UTF8));
            mailMessage.Subject = subject;
            mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
            mailMessage.Body = body_content;
            mailMessage.IsBodyHtml = true;
            mailMessage.BodyEncoding = System.Text.UnicodeEncoding.UTF8;
            //mailMessage.Priority = MailPriority.High;

            /* Set the SMTP server and send the email - SMTP gmail ="smtp.gmail.com" port=587*/
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587; //port=25           
            smtp.Timeout = 100;
            smtp.EnableSsl = true;
            smtp.Credentials = smtp_user_info;

            try
            {
                smtp.Send(mailMessage);               
                flag = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return flag;
        }        
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:34,代码来源:EmailClass.cs


示例11: PopulateProjectNameComboBox

        private void PopulateProjectNameComboBox()
        {
            string url = tfsAddressTextBox.Text;
            string username = tfsUsernameTextBox.Text;
            string password = tfsPasswordTextBox.Text;

            Uri tfsUri;
            if (!Uri.TryCreate(url, UriKind.Absolute, out tfsUri))
                return;

            var credentials = new System.Net.NetworkCredential();
            if (!string.IsNullOrEmpty(username))
            {
                credentials.UserName = username;
                credentials.Password = password;
            }

            var tfs = new TfsTeamProjectCollection(tfsUri, credentials);
            tfs.Authenticate();

            var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

            projectComboBox.Items.Clear();
            foreach (Project project in workItemStore.Projects)
                projectComboBox.Items.Add(project.Name);

            int existingProjectIndex = -1;
            if (!string.IsNullOrEmpty(options.ProjectName))
                existingProjectIndex = projectComboBox.Items.IndexOf(options.ProjectName);
            projectComboBox.SelectedIndex = existingProjectIndex > 0 ? existingProjectIndex : 0;
        }
开发者ID:Kalroth,项目名称:turtletfs,代码行数:31,代码来源:Options.cs


示例12: Send

 public static bool Send(MailObject mailObject)
 {
     bool result = false;
     try
     {
         MailMessage newMail = new MailMessage();
         System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
         newMail.Subject = mailObject.Receiver.Subject;
         newMail.Body = mailObject.Receiver.Body;
         newMail.From = new MailAddress(mailObject.MailAddress);
         foreach (var item in mailObject.Receiver.MailAddress.Split(','))
             newMail.To.Add(item);
         newMail.IsBodyHtml = mailObject.IsBodyHtml;
         client.Host = mailObject.HostName;
         System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential(mailObject.MailAddress, mailObject.MailPassword);
         client.Port = mailObject.PortNumber;
         client.EnableSsl = mailObject.EnableSsl;
         client.UseDefaultCredentials = mailObject.UseDefaultCredentials;
         client.Credentials = basicauthenticationinfo;
         client.DeliveryMethod = SmtpDeliveryMethod.Network;
         client.Send(newMail);
         result = true;
     }
     catch (Exception)
     {
         result = false;
     }
     return result;
 }
开发者ID:hacikaraa,项目名称:Goldepus,代码行数:29,代码来源:Mail.cs


示例13: SendMail

        public bool SendMail(string target, string content, int id)
        {
            try
            {
                MailMessage mailMsg = new MailMessage();

                // To
                mailMsg.To.Add(new MailAddress(target));

                // From
                mailMsg.From = new MailAddress("[email protected]", "Realpoll");

                // Subject and multipart/alternative Body
                mailMsg.Subject = string.Format("Question details for question #{0}", id);
                mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(content, null, MediaTypeNames.Text.Html));

                // Init SmtpClient and send
                SmtpClient smtpClient = new SmtpClient("smtp.sendgrid.net", Convert.ToInt32(587));
                System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(WebConfigurationManager.AppSettings["sendgrid:username"], WebConfigurationManager.AppSettings["sendgrid:password"]);
                smtpClient.Credentials = credentials;

                smtpClient.Send(mailMsg);
                return true;
            }
            catch
            {
                //TODO: Log
                return false;
            }
        }
开发者ID:rlbisbe,项目名称:RealPollSignalR,代码行数:30,代码来源:MailService.cs


示例14: SendMail

        public bool SendMail(string from, string to, string replyto, string subject, string body)
        {
           
            MailMessage msg = new MailMessage(from, to);
            msg.Subject = subject;
            msg.Body = body;
            msg.BodyEncoding = Encoding.UTF8;
            msg.IsBodyHtml = true;
            msg.ReplyToList.Add(replyto);

            //get config params
            string sMTPServerName = WebConfigurationManager.AppSettings["SMTPServerName"].ToString();
            string sMTPLoginName = WebConfigurationManager.AppSettings["SMTPLoginName"].ToString();
            string sMTPPassword = WebConfigurationManager.AppSettings["SMTPPassword"].ToString();
            int sMTPPort = Convert.ToInt32(WebConfigurationManager.AppSettings["SMTPPort"].ToString());


            SmtpClient client = new SmtpClient(sMTPServerName, sMTPPort);
            System.Net.NetworkCredential basicCredential = new System.Net.NetworkCredential(sMTPLoginName, sMTPPassword);
            client.EnableSsl = true;
            client.UseDefaultCredentials = true;
            client.Credentials = basicCredential;
            try
            {
                client.Send(msg);
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }
开发者ID:RAWcom,项目名称:www.stafix24.pl,代码行数:33,代码来源:MailService.cs


示例15: GetSiteManagerClient

        private SiteManager.SiteManagerClient GetSiteManagerClient()
        {
            BasicHttpBinding binding = new BasicHttpBinding();
            if (txtWebApplicationUrl.Text.ToLower().Contains("https://"))
            {
                binding.Security.Mode = BasicHttpSecurityMode.Transport;
            }
            else
            {
                binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            }
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;

            EndpointAddress endPoint = new EndpointAddress(txtWebApplicationUrl.Text + "/_vti_bin/provisioning.services.sitemanager/sitemanager.svc");
            //Set time outs
            binding.ReceiveTimeout = TimeSpan.FromMinutes(15);
            binding.CloseTimeout = TimeSpan.FromMinutes(15);
            binding.OpenTimeout = TimeSpan.FromMinutes(15);
            binding.SendTimeout = TimeSpan.FromMinutes(15);

            //Create proxy instance
            SiteManager.SiteManagerClient managerClient = new SiteManager.SiteManagerClient(binding, endPoint);
            managerClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

            var impersonator = new System.Net.NetworkCredential(txtAccount.Text, txtPassword.Text, txtDomain.Text);
            managerClient.ClientCredentials.Windows.ClientCredential = impersonator;

            return managerClient;
        }
开发者ID:BNATENSTEDT,项目名称:PnP,代码行数:29,代码来源:frmMain.cs


示例16: SendMail

        public void SendMail(string recipient, string subject, string message)
        {
            SmtpClient client = new SmtpClient("mail.leotang.net");

            client.Port = 587;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            System.Net.NetworkCredential credentials =
                new System.Net.NetworkCredential(_sender, _password);
            client.EnableSsl = true;
            client.Credentials = credentials;

            try
            {
                var mail = new MailMessage(_sender.Trim(), recipient.Trim());
                mail.Subject = subject;
                mail.Body = message;
                mail.IsBodyHtml = true;
                client.Send(mail);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw ex;
            }
        }
开发者ID:zhouleink,项目名称:ChinaTea,代码行数:26,代码来源:OutlookMail.cs


示例17: Send

     public static void Send(string gmailuser, string password, string to, string subject, string message, TradeLink.API.DebugDelegate deb)
     {
         d = deb;
         try
         {
             MailMessage mail = new MailMessage();
             System.Net.NetworkCredential cred = new System.Net.NetworkCredential
 (gmailuser, password);
             mail.To.Add(to);
             mail.Subject = subject;
             mail.From = new MailAddress(gmailuser);
             mail.IsBodyHtml = true;
             mail.Body = message;
             SmtpClient smtp = new SmtpClient("smtp.gmail.com");
             smtp.UseDefaultCredentials = false;
             smtp.EnableSsl = true;
             smtp.Credentials = cred;
             smtp.Port = 587;
             smtp.SendCompleted += new SendCompletedEventHandler(s_SendCompleted);
             smtp.Send(mail);
         }
         catch (Exception ex)
         {
             debug("Error sending email from: " + gmailuser + " to: " + to + " subject: " + subject + " err: " + ex.Message + ex.StackTrace);
         }
     }
开发者ID:bluejack2000,项目名称:core,代码行数:26,代码来源:Email.cs


示例18: BasicAuthCredential_NoConfiguration_ReturnDefaultCredential

        public void BasicAuthCredential_NoConfiguration_ReturnDefaultCredential( ) {
            var appSettingsFake = new NameValueCollection( );

            IKuduConfiguration config = CreateConfiguration( null , appSettingsFake );
            var defaultCredential = new System.Net.NetworkCredential( "admin" , "kudu" );
            Assert.Equal( defaultCredential , config.BasicAuthCredential.GetCredentials( ) );
        }
开发者ID:projectkudu,项目名称:kudu,代码行数:7,代码来源:KuduConfigurationFacts.cs


示例19: Main

        static void Main(string[] args)
        {
            JSONHelper s = new JSONHelper();
            SharePointHelper sh = null;
            System.Net.NetworkCredential cred = null;
            if (Settings.Instance.Password.Length > 2)
            {
                cred = new System.Net.NetworkCredential(Settings.Instance.Username, Settings.Instance.Password);
                sh = new SharePointHelper(Settings.Instance.SharePointUrl, cred);
            }
            else
                sh = new SharePointHelper(Settings.Instance.SharePointUrl);

            s.StoreFolder = Settings.Instance.StoreFolder;

            string action = args[0].ToLower();
            if (action == "file")
            {
                RecreateList(sh);
                s.ReadSingleFile(args[1],sh);
            }
            else if (action == "folder")
                s.ReadSingleFolder(args[1]);
            else if (action == "setupsp")
                RecreateList(sh);
            else
                PrintInfo();

        }
开发者ID:uneidel,项目名称:Create-SPLoad,代码行数:29,代码来源:Program.cs


示例20: sendEmail

        public int sendEmail(string recipient,string subject,string body)
        {
            try
            {
                message = new MailMessage();
                message.Subject = subject;
                message.Sender = new MailAddress("[email protected]");
                message.From = new MailAddress("[email protected]");
                message.Body = body;
                message.IsBodyHtml = true;

                message.To.Add(new MailAddress(recipient));

                SmtpClient client = new SmtpClient();
                client.Host = "smtp.gmail.com"; //SMTP server for GMail.
                client.Port = 25;
                client.EnableSsl = true; //SSL connection is required to be true.
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                System.Net.NetworkCredential credential = new System.Net.NetworkCredential("[email protected]", "Iss1234#");
                client.Credentials = credential;
                client.Send(message); //Sending message process.

                return 1;
            }
            catch (Exception exception)
            {
                errorobj.WriteErrorLog("SendEmail-sendmail():::" + exception.ToString());
                return -1;
            }
        }
开发者ID:tianhang,项目名称:SA39_AD,代码行数:31,代码来源:NotifyUserController.cs



注:本文中的System.Net.NetworkCredential类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Sockets.TcpClient类代码示例发布时间:2022-05-24
下一篇:
C# Mail.SmtpClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap