Click here to Skip to main content
15,911,646 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to Upgrade Publish website page in latest version at Visual Studio 2012 Pin
Richard Deeming4-Jul-21 21:36
mveRichard Deeming4-Jul-21 21:36 
QuestionHTTPPOST of EditReport not comiting data to database Pin
Carl Cummings (Canada)2-Jul-21 17:34
professionalCarl Cummings (Canada)2-Jul-21 17:34 
AnswerRe: HTTPPOST of EditReport not comiting data to database Pin
Richard Deeming4-Jul-21 21:34
mveRichard Deeming4-Jul-21 21:34 
GeneralRe: HTTPPOST of EditReport not comiting data to database Pin
Carl Cummings (Canada)5-Jul-21 2:02
professionalCarl Cummings (Canada)5-Jul-21 2:02 
QuestionVisual Studio Freezes during build solution Pin
Robymon1-Jul-21 22:37
Robymon1-Jul-21 22:37 
AnswerRe: Visual Studio Freezes during build solution Pin
Richard Deeming1-Jul-21 23:15
mveRichard Deeming1-Jul-21 23:15 
AnswerRe: Visual Studio Freezes during build solution Pin
Deepak Vasudevan13-Sep-21 21:49
Deepak Vasudevan13-Sep-21 21:49 
QuestionASP.Net Core MVC - Validation Summary not working with bootstrap tabs and dynamically loaded content Pin
SeeSharp223-Jun-21 9:58
SeeSharp223-Jun-21 9:58 
AnswerRe: ASP.Net Core MVC - Validation Summary not working with bootstrap tabs and dynamically loaded content Pin
Richard Deeming23-Jun-21 21:39
mveRichard Deeming23-Jun-21 21:39 
GeneralRe: ASP.Net Core MVC - Validation Summary not working with bootstrap tabs and dynamically loaded content Pin
SeeSharp224-Jun-21 2:21
SeeSharp224-Jun-21 2:21 
GeneralRe: ASP.Net Core MVC - Validation Summary not working with bootstrap tabs and dynamically loaded content Pin
Richard Deeming24-Jun-21 3:54
mveRichard Deeming24-Jun-21 3:54 
GeneralRe: ASP.Net Core MVC - Validation Summary not working with bootstrap tabs and dynamically loaded content Pin
SeeSharp224-Jun-21 4:16
SeeSharp224-Jun-21 4:16 
QuestionCrystal Report Issue in ASP.Net 2010. Pin
Mohammad Salmani8-Jun-21 20:43
Mohammad 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
Mohammad 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
Mohammad 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
philippegent8-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
Member 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
Deepak Vasudevan13-Sep-21 21:45 
AnswerRe: Store Dataset into session variable Pin
C0ding_j3ff28-Apr-21 12:02
C0ding_j3ff28-Apr-21 12:02 

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.