dags att checka in

This commit is contained in:
2021-08-02 12:41:02 +02:00
parent 5648effc9a
commit 668659bf20
34 changed files with 1092 additions and 5 deletions

View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,29 @@
using System;
using System.Net;
namespace HttpWebRequestType
{
class Program
{
static void Main(string[] args)
{
var url = "https://www.di.se/bors/aktier/";
Uri ourUri = new Uri(url);
// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest = WebRequest.Create( url);
// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();
// Use "ResponseUri" property to get the actual Uri from where the response was attained.
if (ourUri.Equals(myWebResponse.ResponseUri))
Console.WriteLine("\nRequest Url : {0} was not redirected", url);
else
Console.WriteLine("\nRequest Url : {0} was redirected to {1}", url, myWebResponse.ResponseUri);
// Release resources of response object.
myWebResponse.Close();
}
}
}