Click here to Skip to main content
15,440,825 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Get a Field value for recovery a password Pin
Luis M. Rojas3-Sep-21 5:55
MemberLuis M. Rojas3-Sep-21 5:55 
GeneralRe: Get a Field value for recovery a password Pin
Richard Deeming3-Sep-21 6:10
mveRichard Deeming3-Sep-21 6:10 
QuestionWebService just will not work :-( Pin
Oliver Freeman1-Sep-21 5:48
MemberOliver Freeman1-Sep-21 5:48 
AnswerRe: WebService just will not work :-( Pin
Richard Deeming1-Sep-21 21:59
mveRichard Deeming1-Sep-21 21:59 
GeneralRe: WebService just will not work :-( Pin
Oliver Freeman2-Sep-21 1:59
MemberOliver Freeman2-Sep-21 1:59 
GeneralRe: WebService just will not work :-( Pin
DerekT-P21-Oct-21 7:37
professionalDerekT-P21-Oct-21 7:37 
QuestionIs it possible to add fore ground and back ground to any app that is down? Pin
samflex31-Aug-21 18:39
Membersamflex31-Aug-21 18:39 
AnswerRe: Is it possible to add fore ground and back ground to any app that is down? Pin
Richard Deeming31-Aug-21 22:01
mveRichard Deeming31-Aug-21 22:01 
You would need to format the message body as HTML.
C#
static async Task SendEmailAsync(string subject, string body, bool isBodyHtml = false)
{
    using MailMessage mm = new(ConfigurationManager.AppSettings["FromEmail"], "joeblow@gmail.com");
    mm.To.Add("janeblow@yahoo.com");
    mm.CC.Add("kevin.bruiner@hotmail.com");
    mm.Subject = subject;
    mm.Body = body;
    mm.IsBodyHtml = isBodyHtml;

    SmtpClient smtp = new()
    {
        Host = ConfigurationManager.AppSettings["Host"],
        Port = int.Parse(ConfigurationManager.AppSettings["Port"]),
        EnableSsl = true,
        UseDefaultCredentials = false,
        Credentials = new NetworkCredential(ConfigurationManager.AppSettings["Username"], ConfigurationManager.AppSettings["Password"]),
    };

    await smtp.SendMailAsync(mm);
}
C#
static async Task<int> Main(string[] args)
{
    System.Collections.Concurrent.ConcurrentDictionary<string, bool> urlToStatus = new();

    IEnumerable<Task<bool>> tasks = args.Select(async url =>
    {
        bool result = await ServerStatusByAsync(url);
        return urlToStatus.TryAdd(url, result);
    });

    bool[] results = await Task.WhenAll(tasks);

    StringBuilder body = new("<p>Please find the status of the DMZ servers below:</p>");
    body.Append("<ul>");
    foreach (var kvp in urlToStatus)
    {
        string encodedLink = System.Net.WebUtility.HtmlEncode(kvp.Key);
        
        body.Append(kvp.Value ? "<li>" : "<li style=\"color:red;background-color:yellow;\">");
        body.Append(kvp.Value ? "<a href=\"" : "<a style=\"color:red;\" href=\"");
        body.Append(encodedLink);
        body.Append("\">");
        body.Append(encodedLink);
        body.Append("</a> - ");
        body.Append(kvp.Value ? "WORKING" : "DOWN");
        body.Append("</li>");
    }
    body.Append("</ul>");

    await SendEmailAsync("DMZ Server Status", body.ToString(), true);
    await Task.Delay(3000);

    // Return the number of servers which were down:
    return results.Count(result => !result);
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Is it possible to add fore ground and back ground to any app that is down? Pin
samflex1-Sep-21 5:50
Membersamflex1-Sep-21 5:50 
GeneralRe: Is it possible to add fore ground and back ground to any app that is down? Pin
Richard Deeming1-Sep-21 21:47
mveRichard Deeming1-Sep-21 21:47 
GeneralRe: Is it possible to add fore ground and back ground to any app that is down? Pin
samflex2-Sep-21 3:02
Membersamflex2-Sep-21 3:02 
Questionproject code in .net for online banking transaction Pin
Jk 0724-Aug-21 5:12
MemberJk 0724-Aug-21 5:12 
AnswerRe: project code in .net for online banking transaction Pin
Richard MacCutchan24-Aug-21 5:40
mveRichard MacCutchan24-Aug-21 5:40 
GeneralRe: project code in .net for online banking transaction Pin
Member 1534301831-Aug-21 22:04
MemberMember 1534301831-Aug-21 22:04 
QuestionI am having problem creating a script to monitor Rest/API services. Pin
samflex23-Aug-21 8:11
Membersamflex23-Aug-21 8:11 
AnswerRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming23-Aug-21 21:15
mveRichard Deeming23-Aug-21 21:15 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex24-Aug-21 5:08
Membersamflex24-Aug-21 5:08 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
David Mujica24-Aug-21 6:04
MemberDavid Mujica24-Aug-21 6:04 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex24-Aug-21 6:09
Membersamflex24-Aug-21 6:09 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 4:18
Membersamflex25-Aug-21 4:18 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
David Mujica25-Aug-21 5:24
MemberDavid Mujica25-Aug-21 5:24 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 6:09
Membersamflex25-Aug-21 6:09 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming25-Aug-21 6:18
mveRichard Deeming25-Aug-21 6:18 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 8:23
Membersamflex25-Aug-21 8:23 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming25-Aug-21 22:12
mveRichard Deeming25-Aug-21 22:12 

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.