url

Suggestions to improve VB.NET URL shortener?

Here is my function (updated): Public Shared Function shortenUrl(ByVal URL As String) As String Return shortenUrl(URL, 32) End Function Public Shared Function shortenUrl(ByVal URL As String, ByVal maxLength As Integer) As String If URL.Length > maxLength Then String.Format("{0}...{1}", URL.Substring(0, (maxLength / 2)), ...

Python Find Question

I am using Python to extract the filename from a link using rfind like below: url = "http://www.google.com/test.php" print url[url.rfind("/") +1 : ] This works ok with links without a / at the end of them and returns "test.php". I have encountered links with / at the end like so "http://www.google.com/test.php/". I am have trouble ...

ASP.Net MVC - handling bad URL parameters

What's the best way to handle a visitor constructing their own URL and replacing what we expect to be an ID with anything they like? For example: http://stackoverflow.com/questions/236349 But the user could just as easily replace the URL with: http://stackoverflow.com/questions/foo I've thought of making every Controller Function pa...

Decode escaped Url without using HttpUtility.UrlDecode

Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode() can do that job but I don't want to add a reference to System.Web.dll. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly. UPDATE: Check Rick Strahl's blog post...

What is the quickest way to get the String contents of a URL using Cocoa/iPhoneSDK?

Say I want to get the HTML of http://www.google.com as a String using some built-in classes of the Cocoa Touch framework. What is the least amount of code I need to write? I've gotten this far, but can't figure out how to progress. There must be an easier way. CFHTTPMessageRef req; NSURL *url = [NSURL URLWithString:@"http://www.goog...

Forward URL and still return 200 not 302 in ASPX

I want this page to return 200 whilst still sending the redirect... <script> sub page_load 'Get the parameters dim content As String content = request.querystring("text") response.redirect ("http://100.200.100.10/test1/Default.aspx?CommandParm=" + content) end sub </script> <html> <head> ...

Limit for URL length for "rundll32 url.dll,FileProtocolHandler"?

I have a long URL with tons of parameters that I want to open in the default browser from Java on a Windows system using Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url) For short URLs like "http://www.google.com" this works fine. But for long URLs (say, 2000 characters), this simply does absolutely nothing at al...

How do I check for valid (not dead) links programatically using PHP?

Given a list of urls, I would like to check that each url: Returns a 200 OK status code Returns a response within X amount of time The end goal is a system that is capable of flagging urls as potentially broken so that an administrator can review them. The script will be written in PHP and will most likely run on a daily basis via c...

Best approach for redirecting a large number of old URLs to new URLs?

We are re-platforming for a client, and they are concerned about SEO. Their current site supports SEO friendly URLs, and so does the new platform. So for those, we are just going to create the same URL mapping. However, they have a large number of other URLs that are not SEO friendly that they want to permanently redirect. These do not f...

Alternative to deprecated javax.servlet.http.HttpUtils.parseQueryString?

I am looking to parse a URL to obtain a collection of the querystring parameters in Java. To be clear, I need to parse a given URL(or string value of a URL object), not the URL from a servlet request. It looks as if the javax.servlet.http.HttpUtils.parseQueryString method would be the obvious choice, but it has been deprecated. Is the...

Sorting list of URLs by length in Jython

Hi, I am writing a Jython script to sort a list of URLs. I have a list that looks like this: http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/folder3/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/|,1...

How do I change a SharePoint 2007's URL

I created a new SharePoint portal for testing purposes using a manually added HOSTS record. I have it all tested and want to expose it to the outside world using a URL from our DNS. I can't seem to find a straight forward way to change the URL of a SharePoint portal. Does anyone know where this setting is? Thanks. ...

How can I extract URL and link text from HTML in Perl?

I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries. If the page contained these links: <a href="http://www.google.com"&gt;Google&lt;/a&gt; <a href="http://www.apple.com"&gt;Apple&lt;/a&gt; The output would be: Google, http://www.google.com Apple, http://www.ap...

How to embed a tag within a url templatetag in a django template?

How do I embed a tag within a url templatetag in a django template? Django 1.0 , Python 2.5.2 In views.py def home_page_view(request): NUP={"HOMEPAGE": "named-url-pattern-string-for-my-home-page-view"} variables = RequestContext(request, {'NUP':NUP}) return render_to_response('home_page.html', variables) In home_page...

getUrl using Java

Is there a way of getting the websites absolute URL (http://www.domain.com/) using Java? because I've googled a bit but I only come across with having to make 2 or 3 classes to create that function =/ Thanks ...

Python filter/remove URLs from a list

Hi. I have a text file of URLs, about 14000. Below is a couple of examples: http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&amp;param2=123 http://www.domainname.com/images?IMAGE_ID=10 http://www.domainname.com/pagename?CONTENT_ITEM_ID=101&amp;param2=123 http://www.domainname.com/images?IMAGE_ID=11 http://www.domainname.com/page...

Slicing URL with Python

Hi. I am working with a huge list of URL's, you guys have already helped me :) Just a quick question I have trying to slice a part of the URL out, see below: http://www.domainname.com/page?CONTENT_ITEM_ID=1234&amp;param2&amp;param3 How could I slice out: http://www.domainname.com/page?CONTENT_ITEM_ID=1234 Sometimes there is more ...

Encode URLs into safe filename string

I'm writing a simple C++ class in which I would like cache picture thumbnails versions of images downloaded from the web. As such, I would like to use a hash function which takes in URL strings and outputs a unique string suitable as a filename. Is there a simple way to do this without re-writing the function myself? I searched around...

Get full request url, including parameters in controller

How do I get the complete request URL (including query string) in my controller? Is it a matter of concatenating my URL and form parameters or is there a better way. I checked this question, but it seems not to be applicable to MVC. Correct me if I'm wrong. --Edit (extended problem description)-- My call to my SearchController.Advan...

How can I provide context to a URLStreamHandler?

Our application defines a URL scheme whose resolution is context-sensitive: The content of the URL depends on the state of an in-progress database transaction. As such, to retrieve the content I cannot, for example, open a new database connection. However, I can't see a way to get at external context from the URLStreamHandler instance...