Expand Url - CSharp Network

CSharp examples for Network:URL

Description

Expand Url

Demo Code


using System.Web.Mvc;
using System.Xml.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;/*from ww w  .j  ava 2s  . com*/

public class Main{
        private static string ExpandUrl(string input)
        {
            try
            {
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(input);
                WebResponse res = req.GetResponse();
                return res.ResponseUri.ToString();
            }
            catch
            {
                return input;
            }
        }
}

Related Tutorials