Passing a parameter via URL to SQL Server Reporting Services

First, be sure to replace Reports/Pages/Report.aspx?ItemPath= with ReportServer?. In other words, instead of this: http://server/Reports/Pages/Report.aspx?ItemPath=/ReportFolder/ReportSubfolder/ReportName Use this syntax: http://server/ReportServer?/ReportFolder/ReportSubfolder/ReportName Parameters can be referenced or displayed in a report using @ParameterName, whether they’re set in the report or in the URL. You can attach parameters to the URL with &ParameterName=Value. To hide the toolbar where parameters … Read more

What is the idiomatic way to compose a URL or URI in Java?

As of Apache HTTP Component HttpClient 4.1.3, from the official tutorial: public class HttpClientTest { public static void main(String[] args) throws URISyntaxException { List<NameValuePair> qparams = new ArrayList<NameValuePair>(); qparams.add(new BasicNameValuePair(“q”, “httpclient”)); qparams.add(new BasicNameValuePair(“btnG”, “Google Search”)); qparams.add(new BasicNameValuePair(“aq”, “f”)); qparams.add(new BasicNameValuePair(“oq”, null)); URI uri = URIUtils.createURI(“http”, “www.google.com”, -1, “/search”, URLEncodedUtils.format(qparams, “UTF-8”), null); HttpGet httpget = new … Read more

.NET – Get protocol, host, and port

Even though @Rick has the accepted answer for this question, there’s actually a shorter way to do this, using the poorly named Uri.GetLeftPart() method. Uri url = new Uri(“http://www.mywebsite.com:80/pages/page1.aspx”); string output = url.GetLeftPart(UriPartial.Authority); There is one catch to GetLeftPart(), however. If the port is the default port for the scheme, it will strip it out. … Read more

CSS, JS and images do not display with pretty url

When you use relative url’s, the browser will dynamically create a complete url by using the url of the resource it loaded. In other words: It uses the url as it is displayed in the address bar. In your case (www.domain.com/subfolder/index.php/key) it tries to load any relative url relative to www.domain.com/subfolder/index.php/. Your resources are however … Read more

Relative URLs in AJAX requests

(updated to make it more readable) This is how relative paths is supposed to work. Pretend that the current address is this: Absolute: protocol://some.domain.name/dir1/dir2/filename If you specify only a new filename “foo”, you get the same protocol, host and dirs, only the file name is changed: Relative: foo Absolute: protocol://some.domain.name/dir1/dir2/foo If you specify a whole … Read more

Python: Get URL path sections

Extract the path component of the URL with urlparse: >>> import urlparse >>> path = urlparse.urlparse(‘http://www.example.com/hithere/something/else’).path >>> path ‘/hithere/something/else’ Split the path into components with os.path.split: >>> import os.path >>> os.path.split(path) (‘/hithere/something’, ‘else’) The dirname and basename functions give you the two pieces of the split; perhaps use dirname in a while loop: >>> while … Read more