uri

Why is the Fragment of a Uri ignored in the Equals method?

I'm trying to maintain a collection of objects based on their URI: public class ConceptCollection : KeyedCollection<Uri, Concept> { protected override Uri GetKeyForItem(Concept item) { return item.Uri; } } However, the URI regularly only differs based on the Fragment of the Uri. So, the following causes an error: Co...

How do I sanitize title URIs?

Hello, I am programming a blog and I want the URIs to be the title like the question title here in stackoverflow or like wordpress. What are the rules for sanitizing a URI? Is there an already made code in PHP that does this? Thanks in advance, Omer ...

Access To Restricted URI Denied (Trying to Call a WCF Method from XMLHTTP)

Hi. I am using XMLHTTP from withing my web project to call a WCF method in my service library that is hosted on another port. The project is hosted on port 2541: localhost:2524/Web-Project/test.aspx When I fire a button on test.aspx, it issues an XMLHTTP request doing a REST-style GET pointing at the below URL string: localhost:4...

Check if relative URI exists

I want to check if a URI returns a valid result. Example: String path = String.Format("{0}/agreements/{1}.gif", PicRoot, languageTwoLetterCode); WebRequest request = WebRequest.Create(new Uri(path, UriKind.Relative)); ... This throws a notsuportedexception. So I figure I should be providing the absolute URI. All examples I can find us...

How can I check if I can call host() on a URI object in Perl?

I'm iterating through a list of links on a page, creating a URI object for each. When the URI object is created, I don't know whether the URL has a scheme, so when I later call $uri->host(), I will sometimes get Can't locate object method "host" via package "URI::_generic" at -e line 1. because the URI object is of type URI::_generic,...

Do I need to encode strings (eg URL) I pass as a POST form parameter

Hi Do I need to encode strings (eg URL) I pass as a POST form parameter? Ie I want to pass a URL I have to my web application (ruby on rails) as one of the form parameters. So are there any potential characters in a URL/URI that would need to be encoded? Or perhaps rails would handle this anyway? ...

URI to an XSD File In A Class Library

I have a class library that stores several XSD files. When creating an XmlSchema class in the same library, I would like to know how to get the URI to the XSD file. The library is being deployed with a web application. Is there a way to get the URI from the web application as well? Thanks. ...

HtmlAgilityPack example for changing links doesn't work. How do I accomplish this?

The example on codeplex is this : HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"]) { HtmlAttribute att = link["href"]; att.Value = FixLink(att); } doc.Save("file.htm"); The first issue is HtmlDocument.DocumentElement does not exist! What d...

Handling wild card subdomains with Apache, excluding www, including SEF

There is an answer to the question of handling wild card subdomains, but it does not meet all my needs. I need to do all of these, supposing for example that the domain is example.com: If the domain given is www.example.com it should 301 redirect to example.com because I do not want to have duplicate content that will create problems ...

Convert file path to a file URI?

Does the .NET Framework have any methods for converting a path (e.g. "C:\whatever.txt") into a file URI (e.g. "file:///C:/whatever.txt")? The Uri class has the reverse (from a file URI to absolute path), but nothing as far as I can find for converting to a file URI. Also, this is NOT a ASP.NET application. Thanks! ...

What's the deal with dontEscape support in Uri? .NET 3.5

Documentation state that dontEscape is deprecated and always false. However it actually works. Is it a good idea to use it anyway, or is there any other alternative to send non RFC compliant Http requests? Sample Code: Dim U As New Uri("http://www.google.com/&gt;", True) Dim W As New Net.WebClient() WL(W.DownloadString(U)) ...

Creating Uri from base and relative parts - problem with trailing slash

Hi! I am having a problem with Uri constructor. Results differ on whether base path ends with slash or not. var baseWithSlash = new Uri(@"c:\Temp\"); \\ "StackOverflow colorer workaround :) var baseNoSlash = new Uri(@"c:\Temp"); var relative = "MyApp"; var pathWithSlash = new Uri(baseWithSlash, relative); // file:///c:/Temp/MyApp va...

best way to support zeroconf in a URI syntax?

what is the best way to support zeroconf names in the location segment of a URI design? RFC 3986 (Uniform Resource Identifier (URI): Generic Syntax) makes no mention of zeroconf and i fear the URI syntax is not designed to work beyond DNS resolution. the ideal answer syntax will: conform to the generic URI syntax handle zeroconf n...

HttpWebRequest long URI workaround?

I've encountered an issue with HttpWebRequest that if the URI is over 2048 characters long the request fails and returns a 404 error even though the server is perfectly capable of servicing a request with a URI that long. I know this since the same URI that causes an error if submitted via HttpWebRequest works fine when pasted directly ...

So what IS the right direction of the path's slash (/ or \) ?

it seems windows insist on writing this slash on files' path \, while .net's URI class writing this the other way? Is there any right way? that is accepted even in the most primitive systems? And why the .net's URI is showing the other slash than windows does? Thanks. ...

Mapping a URI to String-field in LINQ-to-SQL

I'm trying to store a URI as a string in a database, using LINQ. [Column(Name = "Url", DbType = "nvarchar(255)")] public Uri Url { get { return new Uri(_url); } set { _url = value.AbsoluteUri; } } private string _url; This maps nicely to my database design, however, when trying to fetch data u...

RDF and uuid. why no urn schema ?

<rdf:Description about='uuid:8949dbc6-31ad-11d9-9c7d-d112c21f7031'> Why this about does not contain urn:uuid:8949dbc6-31ad-11d9-9c7d-d112c21f7031 instead? Isn't the uuid a urn, and therefore required to have a urn: scheme in front of it ? ...

Why is 'http://dd ' a valid URL?

I'm writing a .NET 3.5 app and using URI.IsWellFormedUriString(string uriString, UriKind uriKind) to verify user-inputted URIs; using UriKind.Absolute. I was just playing with the application and I'm a bit worried and confused as to why something like: http://ddd is a valid URI? What gives? I know it's because it's part of the RFC, b...

URI Escape C++ wstring

I am looking for a good way to do a URI Escape in C++ that would be reasonable for a cross platform project. I would like a function that would take a string like this: L"jiayou加油" And return: L"jiayou%E5%8A%A0%E6%B2%B9" I looked at using some thing like this, with minor modifacations to use wchar_t. However that would require con...

Problem Publishing Silverlight Application LocalHost

I am trying to publish my SilverLight application to the web and I keep getting "An error occurred while trying to make a request to URI "http://localhost:2898....". I've changed the ServiceReferences.ClientConfig to point to the web address but the app still keeps on trying to connect to localhost. I've opened the application in FireF...