Все вопросы: [uri]

100 вопросов

62
голосов
10ответов
87982 просмотров

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

It seems Windows insists on writing a backslash \ in file paths, whereas .NET's URI class writes them with a slash /. Is there any right way, that is accepted even in the most primitive systems? And why is .NET's URI showing the other slash compared with the rest of Windows?

11
голосов
4ответов
8240 просмотров

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 HttpW...

3
голосов
3ответов
308 просмотров

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 t...

4
голосов
2ответов
3500 просмотров

Creating Uri from base without trailing slash and relative parts

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\"); var baseNoSlash = new Uri("c:\Temp"); var relative = "MyApp"; var pathWithSlash = new Uri(baseWithSlash, relative); // file:///c:/Temp/MyApp var pat...

4
голосов
1ответов
1096 просмотров

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/>", True) Dim W As New Net.WebC...

206
голосов
7ответов
201189 просмотров

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 System.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 an ...

1
голосов
1ответов
394 просмотров

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 du...

2
голосов
1ответов
6273 просмотров

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 HtmlDocume...

0
голосов
1ответов
991 просмотров

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.

2
голосов
3ответов
2426 просмотров

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

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?

5
голосов
2ответов
500 просмотров

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. bec...

1
голосов
1ответов
2305 просмотров

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 th...

2
голосов
4ответов
4970 просмотров

How do I sanitize title URIs with PHP?

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

5
голосов
2ответов
722 просмотров

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 ...

0
голосов
3ответов
389 просмотров

Href on random element in jQuery

I find myself using this method a ton to perform actions based on a anchor tag's URL (with jQuery): ("a").live("click", function(event) { event.preventDefault(); var href = $(this).attr("href"); // do something with URL } Elsewhere in my app, I've got some tabular data which I'm a...

0
голосов
4ответов
227 просмотров

How to name Resource Identifiers?

I have a Restful web service. Reservation room can change. Which URI is better solution? a) http://localhost/hotel/Xhotel/Reservation/15 b) http://localhost/hotel/Xhotel/Room/4/Reservation/15 c) http://localhost/hotel/Xhotel/Reservation/15/Room/4

4
голосов
4ответов
1692 просмотров

I know that java.net.URL tries to resolve the URL; does java.net.URI do the same?

A quick Google didn't turn up a definitive answer. If URI does do this, is there a widespread third-party library that won't do this? I just need some parsing, and I can't have unpredictable delays while the constructor attempts to resolve a URI? Thanks.

6
голосов
4ответов
982 просмотров

REST and URI Caching

As I understand it, using a hypertext-driven RESTful Web service, a client is not supposed to know anything about server URI layout except for a couple of well-known entry points. This is supposed to enable the server to control its own URI space and reduce coupling with the client. When a clien...

0
голосов
8ответов
878 просмотров

passing GET parameters that look like URI directories

I've seen a lot of URIs that look something like this: www.fakesite.net/stories/1234/man_invents_fire and I was wondering if the /1234/man_invents_fire part of the URI are actually directories or if they are GET parameters (or something else). I've noticed that a lot of times the /man_invents_...

0
голосов
3ответов
1469 просмотров

SEO and URI Structure

Standard SEO caveat: It's a black box, and the algorithms are proprietary, and trying to predict and game the search engines is a crappy way to make a living. That said, what are the baseline steps you want to take to make sure your content is visible to the major search engines (Google, Bing, e...

0
голосов
1ответов
65 просмотров

How can I abstract away the .swf named from an embeddable Flash tag?

Youtubes flash player has embed links like http://www.youtube.com/v/5oiQdTfMAmo&hl=en&fs=1& How can I do the same thing, where there is no mention of .swf and the file that the player points to is encoded in the URI.

3
голосов
2ответов
1181 просмотров

File:// link doing nothing in all browsers

I have a link being generated that looks like so: <a target="_blank" title="Test" href="file:///c:/test.xls">Test</a> This link is inside an iframe. When I click on it (in any major browser), nothing happens. Fiddler records no traffic. Pasting the URL into the nav bar works fine...

5
голосов
4ответов
2771 просмотров

Storing Data in URIs After Hash

I want to store key/value pairs in URI's after the hash for use on the client side like so: http://www.foo.com/index.html#foo=bar&baz=quux Is there a pre-existing solution that already does this or should I roll my own? I'm already using JQuery so a JQuery solution would be particularly w...

3
голосов
5ответов
7191 просмотров

How do I format a URI when binding an Image in Silverlight?

I haven't been able to find an answer to this. I have a database that has image paths in it ("images/myimage.jpg"). These images exist on my asp.net site which is also where I host the SL. I want to bind these images to my ListBox control so that the image displays. I have read that since I h...

63
голосов
9ответов
118223 просмотров

How do I pass a datetime value as a URI parameter in asp.net mvc?

I need to have an action parameter that has a datetime value? Is there a standard way to do this? I need to have something like: mysite/Controller/Action/21-9-2009 10:20 but I'm only succeeding indoing it with something like: mysite/Controller/Action/200909211020 and writing a custome fun...

6
голосов
3ответов
14408 просмотров

Parsing URL string in Ruby

I have a pretty simple string I want to parse in ruby and trying to find the most elegant solution. The string is of format /xyz/mov/exdaf/daeed.mov?arg1=blabla&arg2=3bla3bla What I would like to have is : string1: /xyz/mov/exdaf/daeed.mov string2: arg1=blabla&arg2=3bla3bla so basicall...

0
голосов
5ответов
3485 просмотров

RDF integration with C#

I'm working on a project where i had been asked to do a semantic search. The scenario is a database with a table containing 3 pieces of information, Doctor Name, Patient Name, and Date of Visit. I had been asked to create a form that contains 3 fields: Doctor, Patient and Date. So when a user wan...

41
голосов
7ответов
59739 просмотров

Can a URL contain a semicolon and still be valid?

I am using a regular expression to convert plain text URL to clickable links. @(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.-]*(\?\S+)?)?)?)@ However, sometimes in the body of the text, URL are enumerated one per line with a semi-colon at the end. The real URL does not contain any ";". http://www.aaa...

0
голосов
1ответов
734 просмотров

Has anyone gotten IE8 to read DHTML behaviors encoded as base64'd data URIs?

Here is the HTC content I'm encoding (nothing fancy): Here is the definition in the CSS file, with the above component base64'd: .something { -ms-behavior: url(data:text/x-component;base64,PHB1YmxpYzpjb21wb25lbnQ+PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPmFsZXJ0KCdiYXNlNjQnKTs8L3Njcml...

4
голосов
1ответов
3526 просмотров

How to use an embedded image of a separate assembly?

there are many related questions/answers about that in SO. I took a look to some of them but none really match. An assembly (called ResourcesLoader) holds images as embedded ressources. I would like to use these pictures in another assembly. After looking at msdn pack uri, and seeing a lots of...