uri

Authentication using URI userinfo component http://userinfo@hostname:port/path in a servlet

Hi, I need to identify users according to an URI subset. It has the following pattern http://userinfo@hostname:port/path. The java.net.URI (http://java.sun.com/j2se/1.4.2/docs/api/java/net/URI.html) implementation represents the URI. However, in the servlet i was not able to retrieve the URL/URI containing the "userinfo" URI's componen...

How to get Uri.EscapeDataString to comply with RFC 3986

The Uri class defaults to RFC 2396. For OpenID and OAuth, I need Uri escaping consistent with RFC 3986. From the System.Uri class documentation: By default, any reserved characters in the URI are escaped in accordance with RFC 2396. This behavior changes if International Resource Identifiers or International Domain Name parsing i...

What is Uri.LocalPath defined to do with non local paths?

The docs for Uri.LocalPath don't say what happens if you feed it a non local path like http://stackoverflow.com/. Does anyone know of a source that gives the official spec for how it handle this? I'm wanting to know what kind of gotchas and corner cases it might have so I can't be sure I've got thing right by just trying things. (alter...

Most general way to make a Uri object?

I need to convert all of the following forms into .NET Uri object: "hello.world" "..\something\somthing" "../something/somthing/else" "c:\autoexec.bat" "http://whatever.com/nevermind.html" more or less anything else that you might expect to find in something building local or web path. I have already checked an new Uri("..\somthing\s...

Registering custom url protocl handler that Outlook recognizes?

Good morning, I've successfully created a little app that registers itself under a custom uri protocol ('irma:') following the msdn entry at http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx This works perfectly fine when opening such a link manually via the shell/cmd etc, but when sending out links like that, outlook does n...

How to combine URIs

I have two Uri objects passed into some code, one is a directory and the other is a filename (or a relative path) var a = new Uri("file:///C:/Some/Dirs"); var b = new Uri("some.file"); when I try and combine them like this: var c = new Uri(a,b); I get file:///C:/Some/some.file where I wold expect to get the same effect as with ...

Is there anything that i can replace AbsolutePath.Contains with?

I have a Uri that contains a part of the path that i am putting in the if block. Its something like if (absUri.AbsolutePath.Contains("W3C//DTD%20XHTML%201.1//EN")) I want to replace .Contains part with something more reliable and robust as if there is some piece of string after //EN, even that will satisfy the if block. The whole p...

Visual Studio > XML Parser > Register an URI prefix

Hey everyone, I started using Visual Studio for writing my XUL, because it gives me intellisense and validation, as I use a special XUL xml-schema. There are still some problems with this approach, that I want to fix to make VS a more usable XUL-IDE. VS doesn't know anything about the chrome-protocol and gives me an error ("The URI pr...

How to make OpenFileDialog accept "valid" URIs

I need to use OpenFileDialog to input a URI or local path. The problem is that the schema of the URL is not something windows knowns about (or should know about because it's a hack for testing). I can turn off all validation and as long as I don't feed it a invalid chars it returns but then it will happily eat anything else and that isn...

Is there a regular expression to strip specific query variables from a URI?

I have a bunch of HTML that is generated by a daemon using C, XML and XSL. Then I have a PHP script which picks up the HTML markup and displays it on the screen I have a huge swathe of XHTML 1 compliant markup. I need to modify all of the links in the markup to remove &utm_source=report&utm_medium=email&utm_campaign=report. ...

Remove subdomain from string in ruby

I'm looping over a series of urls and want to clean them up I currently have the following code # Parse url to remove http, path and check format o_url = URI.parse(node.attributes['href']) # Remove www new_url = o_url.host.gsub('www.', '').strip How can I extend this to remove the subdomains that may exist in some urls? ...

How can I read the URL parameter in a Perl CGI program?

How can I read the URL parameter in a Perl CGI program? ...

How to create correctly escaped file:// URI in C#?

What would be the correct way to create a fully URL-encoded file:// URI from a local path, i.e. where all special characters such as blanks etc are escaped? Given the following input C:\Data\Input Document.txt I would like to get file:///C:/Data/Input%20Document.txt I've been using Uri uri = new Uri(@"C:\Data\Input Document.txt...

Is the front controller responsible for deciding which controllers/modules to load?

Hi, I am working on a website script, and currently I have a front controller, which determines what to load (e.g. what modules/extensions and controllers) based on the URI. Is this a good approach? I'm using PHP if that matters. I'm just wondering if that's not the front controller's job... ...

How to create path redirections

I want to create internal path redirections like in Wordpress e.g. if i have a post (having permalink = 'hello-world') but still if I type 'http://localhost/hello/', I get redirected to 'http://localhost/hello-world' So what code do i use to automatically go to that page with that correct URI, i.e. change the URI that gets displayed in...

How to pull the server name from a UNC

Would anyone be able to tell me how to pull the server name out of a UNC? ex. //servername/directory/directory Edit : I apologize but it looks like I need to clarify a mistake: the path actually is more like: //servername/d$/directory I know this might change things a little ...

Regular Expressions ~ convert UNC to URL

Hey, I'm looking for a nice tight regex solution to this problem. I'm looking to reformat an UNC into a Uri Problem: UNC directory needs to be reformatted into a Uri \\server\d$\x\y\z\AAA needs to look like: http://server/z/AAA ...

need a c# regex to get servername out of UNC

I screwed up my last post. Lets see if I can get this one right.. Would anyone be able to tell me how to pull the server name out of a UNC? (I'm looking for a regex) this is the string I want to pull the servername from: **\\\servername\d$\directory** My Code is in C# Regex r = new Regex(?????, RegexOptions.IgnoreCase); Match m =...

Using relative URI as XmlDataProvider's Source

Is it possible to use a relative URI when setting the Source property on an XmlDataProvider object in .NET? I get the following exception: IOException:System.IO.IOException: Cannot locate resource 'configuration.xml'. When I set the Source property using an absolute URI, everything works as expected: provider.Source = new Uri(@"C:\bi...

URL for a resource located on the local machine in REST ROA

This question is in terms of a RESTful ROA (Resource-Oriented Architecture). A resource on the Web has a URL (or URI if you prefer), for instance http://myserver.com/me.jpg. You can get a file on the local (Windows) machine like this: file:///C:/MyPictures/me.jpg. This is not exactly a "Universal" Resource Identifier; it doesn't work...