Hi,
I need to UrlDecode a string in a simple console application, but I am
having trouble accessing Server.UrlDecode, even though System.Web is
included. The application pulls a text out of a referring URL string
and (eventually) will run a simple report.
Here is an excerpt of my code:
using System;
using System.Web;
using System.Text.RegularExpressions;
namespace Adsense
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string test = @"http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-2969997630540970&random=1089721646950&lmt=10897216 46&format=728x90_as&output=html&channel=7097594418 &url=http%3A%2F%2Fboats.designerz.com%2Fboating-canoeskayaks.php&color_bg=f5f5f5&color_text=0";
Console.WriteLine (test);
Regex re = new Regex(@"\&url\=([^&]+)&");
Console.WriteLine(Server.UrlDecode(re.Match(test). Groups[1]));
}
}
}