How do I correctly reference uriparser?

Mar 30 2016 9:30 AM
Hi. I am trying to add a procedure to a C# project. The procedure contains
typeof(UriParser)

but I get a compiler error:

The type or namespace name 'UriParser' could not be found (are you missing a using directive or an assembly reference?)

The following lines are included above the namespace:
using System;
using System.Text;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Reflection;

What am I missing? How can I correctly include UriParser in my project?

Thank you.

The entire procedure is to do with removing an unescaped slash from the url:
public void LeaveDotsAndSlashesEscaped()
{
var getSyntaxMethod =
typeof(UriParser).GetMethod("GetSyntax", BindingFlags.Static | BindingFlags.NonPublic);
if (getSyntaxMethod == null)
{
//throw new MissingMethodException("UriParser", "GetSyntax");
}

var uriParser = getSyntaxMethod.Invoke(null, new object[] { "http" });

var setUpdatableFlagsMethod =
uriParser.GetType().GetMethod("SetUpdatableFlags", BindingFlags.Instance | BindingFlags.NonPublic);
if (setUpdatableFlagsMethod == null)
{
//throw new MissingMethodException("UriParser", "SetUpdatableFlags");
}

setUpdatableFlagsMethod.Invoke(uriParser, new object[] { 0 });
}


Answers (1)