Click here to Skip to main content
15,438,920 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: ASP.Net Core MVC - Validation Summary not working with bootstrap tabs and dynamically loaded content Pin
SeeSharp224-Jun-21 4:16
MemberSeeSharp224-Jun-21 4:16 
QuestionCrystal Report Issue in ASP.Net 2010. Pin
Mohammad Salmani8-Jun-21 20:43
MemberMohammad Salmani8-Jun-21 20:43 
AnswerRe: Crystal Report Issue in ASP.Net 2010. Pin
Richard Deeming8-Jun-21 21:31
mveRichard Deeming8-Jun-21 21:31 
GeneralRe: Crystal Report Issue in ASP.Net 2010. Pin
Mohammad Salmani8-Jun-21 22:36
MemberMohammad Salmani8-Jun-21 22:36 
GeneralRe: Crystal Report Issue in ASP.Net 2010. Pin
Richard Deeming8-Jun-21 22:51
mveRichard Deeming8-Jun-21 22:51 
GeneralRe: Crystal Report Issue in ASP.Net 2010. Pin
Mohammad Salmani10-Jun-21 4:11
MemberMohammad Salmani10-Jun-21 4:11 
QuestionOutputCacheProvider... Pin
Kornfeld Eliyahu Peter19-May-21 22:29
professionalKornfeld Eliyahu Peter19-May-21 22:29 
Questionaspnet credentials from web.config Pin
philippegent8-May-21 2:14
Memberphilippegent8-May-21 2:14 
To send emails from an (old) asp.net website I use the following code :    
-------

    Protected Sub SendMail(sender As Object, e As System.EventArgs)
        Try
            Dim smtpSection As SmtpSection = CType(ConfigurationManager.GetSection("system.net/mailSettings/smtp"), SmtpSection)
            
            Dim smtp As New SmtpClient
            smtp.Host = smtpSection.Network.Host
            smtp.EnableSsl = smtpSection.Network.EnableSsl
            smtp.UseDefaultCredentials = smtpSection.Network.DefaultCredentials
            smtp.Port = smtpSection.Network.Port
  
            'solution 1 does not work !
            'Dim networkCred As NetworkCredential = New Net.NetworkCredential(smtpSection.Network.UserName, smtpSection.Network.Password)
            'smtp.Credentials = networkCred
            
            'solution 2 does not work !
            'Dim networkCred As New Net.NetworkCredential(smtpSection.Network.UserName, smtpSection.Network.Password)
            'smtp.Credentials = networkCred
            
            'solution 3 does work !!!
            smtp.Credentials = New Net.NetworkCredential("yyyyyy@xxxxxx.com", "zzzzzz")
            
            Using mm As New MailMessage(smtpSection.From, txtTo.Text.Trim())
                mm.Subject = txtSubject.Text.Trim()
                mm.Body = txtBody.Text.Trim()
                mm.IsBodyHtml = False
                
                TextBox2.Text = smtpSection.Network.UserName
                TextBox3.Text = smtpSection.Network.Password
                TextBox4.Text = smtpSection.Network.Host
                TextBox5.Text = smtpSection.Network.Port
                TextBox6.Text = smtpSection.Network.EnableSsl
                TextBox7.Text = smtpSection.Network.DefaultCredentials
                TextBox8.Text = smtpSection.From
                TextBox9.Text = txtTo.Text.Trim()
                
                smtp.Send(mm)

            End Using
            
        Catch error_t As Exception
            TextBox1.Text = error_t.ToString
        End Try
        
    End Sub
-------

The web.config section contains this : 
-------

      <smtp deliveryMethod="Network" from="yyyyyy@xxxxxx.com" >
        <network
            host="smtp-auth.mailprotect.be"
            port="2525"
            userName="yyyyyyyy@xxxxxxxx.com "
            password="zzzzzz"
            defaultCredentials="false"
            enableSsl="false"
        />
      </smtp>
------

The namespaces loaded are : 

    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.Net.Mail" %>
    <%@ Import Namespace="System.Configuration" %>
    <%@ Import Namespace="System.Net.Configuration" %>

Solution 3 works fine but I don't like to show passwords in a page.

When using solution 1 or 2 the mailserver replies it does not relay, so apparently the credentials are not retrieved work properly.
All the other parameters do show properly in the textboxes I designed to test this sub.

Does anyone have a suggestion ?

Thanks.

Philippe Caron

AnswerRe: aspnet credentials from web.config Pin
Dave Kreskowiak8-May-21 4:58
mveDave Kreskowiak8-May-21 4:58 
AnswerRe: aspnet credentials from web.config Pin
Richard Deeming18-May-21 3:56
mveRichard Deeming18-May-21 3:56 
QuestionStore Dataset into session variable Pin
Member 1189497423-Apr-21 23:59
MemberMember 1189497423-Apr-21 23:59 
GeneralRe: Store Dataset into session variable Pin
Richard MacCutchan24-Apr-21 2:25
mveRichard MacCutchan24-Apr-21 2:25 
GeneralRe: Store Dataset into session variable Pin
Deepak Vasudevan13-Sep-21 21:45
MemberDeepak Vasudevan13-Sep-21 21:45 
AnswerRe: Store Dataset into session variable Pin
C0ding_j3ff28-Apr-21 12:02
MemberC0ding_j3ff28-Apr-21 12:02 
QuestionWhat is REDUX? Pin
DineshPadupalli2-Apr-21 1:05
MemberDineshPadupalli2-Apr-21 1:05 
AnswerRe: What is REDUX? Pin
Richard MacCutchan2-Apr-21 2:19
mveRichard MacCutchan2-Apr-21 2:19 
QuestionResponse.Headers.Remove(“Server”) does not work in global.Asax. when run project show “This operation requires IIS integrated pipeline mode” issue Pin
Member 1358101725-Mar-21 1:30
MemberMember 1358101725-Mar-21 1:30 
QuestionRe: Response.Headers.Remove(“Server”) does not work in global.Asax. when run project show “This operation requires IIS integrated pipeline mode” issue Pin
SeanChupas25-Mar-21 3:27
MemberSeanChupas25-Mar-21 3:27 
AnswerRe: Response.Headers.Remove(“Server”) does not work in global.Asax. when run project show “This operation requires IIS integrated pipeline mode” issue Pin
Member 1358101725-Mar-21 20:32
MemberMember 1358101725-Mar-21 20:32 
QuestionRe: Response.Headers.Remove(“Server”) does not work in global.Asax. when run project show “This operation requires IIS integrated pipeline mode” issue Pin
SeanChupas29-Mar-21 0:55
MemberSeanChupas29-Mar-21 0:55 
QuestionThe remote server returned an error: (403) Forbidden. Pin
Vimalsoft(Pty) Ltd24-Mar-21 0:30
professionalVimalsoft(Pty) Ltd24-Mar-21 0:30 
AnswerRe: The remote server returned an error: (403) Forbidden. Pin
Richard Deeming24-Mar-21 2:22
mveRichard Deeming24-Mar-21 2:22 
QuestionPdf to image converter Pin
Member 1501160216-Mar-21 20:42
MemberMember 1501160216-Mar-21 20:42 
AnswerRe: Pdf to image converter Pin
Deepak Vasudevan22-Mar-21 3:13
MemberDeepak Vasudevan22-Mar-21 3:13 
AnswerRe: Pdf to image converter Pin
Bohdan Stupak7-Apr-21 22:09
professionalBohdan Stupak7-Apr-21 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.