Click here to Skip to main content
15,896,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: Need help with Functions, ASAP! Pin
Gerry Schmitz13-Apr-18 7:15
mveGerry Schmitz13-Apr-18 7:15 
AnswerRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 7:49
professional#realJSOP13-Apr-18 7:49 
AnswerRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 7:51
professionalBillWoodruff13-Apr-18 7:51 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 7:53
professional#realJSOP13-Apr-18 7:53 
GeneralRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 9:12
professionalBillWoodruff13-Apr-18 9:12 
GeneralRe: Need help with Functions, ASAP! Pin
Gerry Schmitz16-Apr-18 8:17
mveGerry Schmitz16-Apr-18 8:17 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 8:26
professional#realJSOP13-Apr-18 8:26 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 8:31
professional#realJSOP13-Apr-18 8:31 
GeneralRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 9:14
professionalBillWoodruff13-Apr-18 9:14 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 8:42
professional#realJSOP13-Apr-18 8:42 
GeneralRe: Need help with Functions, ASAP! Pin
Eddy Vluggen13-Apr-18 9:01
professionalEddy Vluggen13-Apr-18 9:01 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:07
professional#realJSOP13-Apr-18 9:07 
GeneralRe: Need help with Functions, ASAP! Pin
Eddy Vluggen13-Apr-18 9:12
professionalEddy Vluggen13-Apr-18 9:12 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:28
professional#realJSOP13-Apr-18 9:28 
AnswerRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:10
professional#realJSOP13-Apr-18 9:10 
PraiseRe: Need help with Functions, ASAP! Pin
Eddy Vluggen13-Apr-18 9:15
professionalEddy Vluggen13-Apr-18 9:15 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:33
professional#realJSOP13-Apr-18 9:33 
GeneralRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 18:54
professionalBillWoodruff13-Apr-18 18:54 
Questiongetting a 200 or what ever it is status_code not a ok Pin
sadsack12-Apr-18 9:04
sadsack12-Apr-18 9:04 
Hello
Below id my C# code for finding the status of a website. I get a ok, what I want is to get a 200.

C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace _200_Test2
{
    class Program
    {
        static void Main(string[] args)
        {

            {
                WebRequest request = WebRequest.Create("http://www.cnn.com/");
                try
                {
                    using (WebResponse response = request.GetResponse())
                    {
                        HttpWebResponse httpResponse = (HttpWebResponse)response;
                        Console.WriteLine(httpResponse.StatusCode);
                        Console.ReadKey();
                    }
                }
                catch (WebException e)
                {
                    using (WebResponse response = e.Response)
                    {
                        HttpWebResponse httpResponse = (HttpWebResponse)response;
                        Console.WriteLine("Error code: {0}", httpResponse.StatusCode);
                        using (Stream data = response.GetResponseStream())
                        {
                            string text = new StreamReader(data).ReadToEnd();
                            Console.WriteLine(text);
                        }
                    }
                }
            }
        }
    }
    
}


I try for days now to get a simple 200.
Maybe someone can look at this and tell me what I am going wrong.
Thank You
renny
AnswerRe: getting a 200 or what ever it is status_code not a ok Pin
Afzaal Ahmad Zeeshan12-Apr-18 9:23
professionalAfzaal Ahmad Zeeshan12-Apr-18 9:23 
GeneralRe: getting a 200 or what ever it is status_code not a ok Pin
sadsack17-Apr-18 13:59
sadsack17-Apr-18 13:59 
AnswerRe: getting a 200 or what ever it is status_code not a ok Pin
Richard MacCutchan12-Apr-18 21:38
mveRichard MacCutchan12-Apr-18 21:38 
GeneralRe: getting a 200 or what ever it is status_code not a ok Pin
sadsack17-Apr-18 14:02
sadsack17-Apr-18 14:02 
QuestionWrite a 2D array of objects in range Excel C# Pin
Gtari Abir12-Apr-18 5:29
Gtari Abir12-Apr-18 5:29 
AnswerRe: Write a 2D array of objects in range Excel C# Pin
Dave Kreskowiak12-Apr-18 7:29
mveDave Kreskowiak12-Apr-18 7:29 

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.