HtmlContentProvider UriFormatException

SyntaxEditor for WPF Forum

Posted 10 years ago by Anders Lassen
Version: 13.2.0592
Avatar

I'm using HtmlContentProvider to encode html into a content object for my Intelliprompt.IContentProvider implementation.

For some HTML input strings i get UriFormatException. I can't see anything wrong with my HTML or the Uri's inside, and I don't really care about the URLs working in the cases where there should be any problem with them. Problem now is that an exception is thrown and I don't know how to build the 'object' to return from GetContent.

Any way to get around this problem?

Comments (3)

Answer - Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Anders,

When we encounter 'a' tags, we effectively do this:

new Hyperlink() { NavigateUri = new Uri(href)

I suspect that something in Microsoft's Uri class doesn't like what is passed in.  Can you scrub the URLs to remove whatever scenario it's not liking, prior to passing in the HTML snippet?


Actipro Software Support

Posted 10 years ago by Anders Lassen
Avatar

Hi, could it be because the URL's are pointing to a https-location which require a password?

Does actipro have some sort of HTML manipulation methods I can use to strip the URLs from the a-tags? It's not important to me that the hyperlinks actually work.

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Anders,

I'm not sure https would matter.  You'd have to look at what the Microsoft Uri class does to know.  We don't have anything for manipulating HTML.  Customers generally build up the HTML snippets themselves.  You might want to use regular expressions to do a replacement of your href attributes or just use a regex to pull them out altogether.

[Modified 10 years ago]


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.