How do I pass url parameters within url parameters - url

I want to show a pdf using google viewer like this:
https://drive.google.com/viewerng/viewer?embedded=true&url=http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf
But my page should be opened with parameters like this:
https://mywebsite.com/pdfgenerator.xhtml?parameter1=true&parameter2=false
(On this page a pdf is generated, and that is not a valid website)
That means that I should pass parameters within the url parameter of the first page, but then they get interpreted as the parameters for the first page.
https://drive.google.com/viewerng/viewer?embedded=true&url=https://mywebsite.com/pdfgenerator.xhtml?parameter1=true&parameter2=false
How do I solve this problem? How do I pass a parameter within a parameter? I can't find any information about it.
Thank you for your help.

It's solved: If you encode it using encodeURIComponent and then pass it as the parameter it works. If you need to do it quickly you can use this TryIt from W3Schools. Adjust the address, click run and click the button, then copy the link.

Related

Why url params doesn't work in some sites?

I'm trying to add param in the url, like in this example:
https://www.google.com/ > https://www.google.com/search?q=qq
Opening the last link you can see "qq" in the "q" input.
For this site it doesn't work (this is the problem):
https://www.calabriasue.it/assistenza/richiesta-assistenza-e-supporto/
https://www.calabriasue.it/assistenza/richiesta-assistenza-e-supporto/?nome=mario
Can I add url param also in the last one? I need it.
Thanks!
I tried using different input names, different params ecc but it doesn't work.
Google's server side code is designed to generate an HTML document with an input field that is prefilled with the current search term which is reads from the URL. That is why adding q=search+term to the URL populates the input field.
You can't make arbitrary third-party websites prefill inputs. They have to explicitly provide a mechanism to make it possible.
Parameters only work as long as the code for the target website is expecting to handle a parameter named "nome" with a value "mario". In the case of the google website, it is expecting a parameter named "q" and has a form input for it.
Clicking a URL sends a a GET request type, and the target site may only be accepting parameters from a POST request type. You could consider using the application known as "PostMan" to help with that.
Alternately, the target page you are viewing may be forwarded / routed from a different page which accepts parameters.

SSRS URL Parameters Issue

I have an issue on where i cannot get the parameters to pass through via url.
Below is the url to the report i want to pass a single ID parameter (#ID).
I have tried a few ways, first time in passing via URL.
Any help grateful.
http://rpt.Server.local/Reports/Pages/Report.aspx?ItemPath=%2f%5bQuality+Sales+Report%5d%2fCP+Quailty+Sales+Details+Report+Preview&ViewMode=Detail
http://rpt.Server.local/Reports/Pages/Report.aspx?ItemPath=%2f%5bQuality+Sales+Report%5d%2fCP+Quailty+Sales+Details+Report+Preview&ViewMode=Detail
instead of above link try below
Go to http://rpt.Server.local/Reportserver
find your report in above link and pass "&ID=(value) at the end of the url
or
http://rpt.Server.local/Reportserver/Pages/Report.aspx?ItemPath=%2f%5bQuality+Sales+Report%5d%2fCP+Quailty+Sales+Details+Report+Preview&ID=(value)

How do I add a parameter to a URL like '?=website-name'

Like the question says, how do I add a parameter to a URL?
Example:
When you click on a link to get a featured product on Product Hunt, the URL is appended with ?ref=producthunt.
Can I just add a parameter like this manually to the few links that I have on my website? Are there any scenarios where this might be suboptimal to do?
The parameters in the URL correspond to the superglobal $_GET array.
It means that if your URL is in the form
www.domain.com?key1=val1&key2=val2 ,
then $_GET[key1] contains val1 , and so on.
It is perfectly legitimate to add these parameters manually in a link (a typical use case would be a login button, which redirects you to the current URL and appends &todo=login . You can then add a bit of PHP code that triggers the login process when $_GET contains the value 'login' at the key 'todo').
The other way of adding these parameters is forms. In an HTML form, you specify a 'method' which can be 'get' or 'post'.
If you choose 'get', when the form is submitted, the URL will automatically be appended with the form answers.
NB: It is generally NOT SAFE to directly read values from the $_GET, as the user can fill it with any value (just by changing the URL) so it is good practice to use filters that ensure inputs are safe. Check http://www.w3schools.com/php/php_filter.asp for more on filters
The parameters added to the url is called query string and they have a format
it must start will ?
every paraper will be seperated with &
Example: http://www.yoururl.com?name=myname&age=34&ect=somethingelse
The mistake you did is by putting ?= which is not converted by your web server.
you can pas like '?websitename=website-name'
Querystring parameters are key value pairs that are separated from the URL's domain and path with a ? and separated from each other with an &, i.e ?key=value&key2=value2.
The values can be accessed client-side (in Javascript) and server-side by the webserver or by a server-side language is being used, PHP, ASP.NET, Java.
Some values should be encoded using a function such as encodeURIComponent to ensure that they are valid.
Risks
You need to be careful that the querystring does not contain any sensitive information such as a sequential order number, i.e ?order=5 as someone could manually change the value to see another user's order (?order=6, if no other authentication in place). The order value should be encrypted so it cannot be guessed. Also, do not execute any code passed in on the querystring with eval() as the contents could be changed by a malicious user to execute a crosssite scripting (XSS) attack on another user and steal their cookie or login credentials.

How do I get the URL returned using ColdFusion

I am accessing a set of websites using variables
<cfhttp url="http://website.com/index.php?title=#var1#:#var2#&action=edit##EditPage" method="GET">
Some pages do not provide the data I need and instead of #EditPage in the URL show a fragment
edit&redlink=1. I want to treat these pages differently. How do I go about identifying them?
The hash "#" used in URL is used by browsers and not servers. Typically when a browser sees the hash in the URL it will jump to either an anchor on the page with the same name, or an element with that id. Exceptions, are when javascript is used to modify the page dynamically based on the hash.
If I'm understanding you correctly, what you want to do is construct the URL in a separate variable first. Something like URLtoGet. Then, you can use cfif to switch on whether that constructed URL contains the fragment you specified. Look into contains(), find(), and findNoCase() to determine which is the best option for you.

Passing a parameter via URL to SQL Server Reporting Services

I'm trying to pass a userId (string) in the URL which will be passed to the database and used by a query in SSRS.
base URL:
http://blah/Reports/Pages/Report.aspx?ItemPath=MyReport
I tried this, but it doesn't work:
http://blah/Reports/Pages/Report.aspx?ItemPath=MyReport&UserId=fred
Any ideas?
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 are displayed, add &rc:Toolbar=false to the URL (reference).
Putting that together, you can run a URL with embedded values, or call this as an action from one report and read by another report:
http://server.domain.com/ReportServer?/ReportFolder1/ReportSubfolder1/ReportName&UserID=ABC123&rc:Toolbar=false
In the report's dataset properties query: SELECT stuff FROM view WHERE User = #UserID
In the report, set the expression value to [UserID] (or =Fields!UserID.Value)
Keep in mind that if a report has multiple parameters, you might need to include all parameters in the URL, even if blank, depending on how your dataset query is written. That means repeating the parameter name for multiple values of the same parameter, too.
To pass a parameter using Action = Go to URL, set expression to:
="http://server.domain.com/ReportServer?/ReportFolder1/ReportSubfolder1/ReportName&UserID="
&Fields!UserID.Value
&"&rc:Toolbar=false"
&"&rs:ClearSession=True"
Be sure to have a space after an expression if followed by & (a line break is isn't enough). No space is required before an expression. This method can pass a parameter but does not hide it as it is visible in the URL.
If you don't include &rs:ClearSession=True then the report won't refresh until browser session cache is cleared.
To pass a parameter using Action = Go to report:
Specify the report
Add parameter(s) to run the report
Add parameter(s) you wish to pass (the parameters need to be defined in the destination report, so to my knowledge you can't use URL-specific commands such as rc:toolbar using this method); however, I suppose it would be possible to read or set the Prompt User checkbox, as seen in reporting sever parameters, through custom code in the report)
For reference, see this page on URL encoding, e.g. / = %2f
As well as what Shiraz said, try something like this:
http://<server>/ReportServer/Pages/ReportViewer.aspx?%2f<path>%2f<ReportName>&rs:Command=Render&UserID='fred'
Note the path would only work if you are in a single folder. When I have to do this I simply browse to the report using the reportserver path ("reports" is the report manager) and copy the url then add &<ParameterName>=<value> to the end.
Try changing "Reports" to "ReportServer" in your url
According to Microsoft, the format basically is:
http://<server>/reportserver?/<path>/<report>&rs:Command=Render&<parameter>=<value>
Try passing multiple values via url:
/ReportServer?%2fService+Specific+Reports%2fFilings%2fDrillDown%2f&StartDate=01/01/2010&EndDate=01/05/2010&statuses=1&statuses=2&rs%3AFormat=PDF
This should work.
I solved a similar problem by passing the value of the available parameter in the URL instead of the label of the parameter.
For instance, I have a report with a parameter named viewName and the predefined Available Values for the parameter are: (labels/values) orders/sub_orders, orderDetail/sub_orderDetail, product/sub_product.
To call this report with a URL to render automatically for parameter=product, you must specify the value not the label.
This would be wrong:
http://server/reportserver?/Data+Dictionary/DetailedInfo&viewName=product&rs:Command=Render
This is correct:
http://server/reportserver?/Data+Dictionary/DetailedInfo&viewName=sub_product&rs:Command=Render
Use the URL, mentioned below to open the report in a new window with dynamic parameters.
="javascript:void(window.open('http://Servername/ReportServer?/Foldername/Reportname&rs:Commnd=Render&parameter1=" & Fields!A.Value & "&parameter2=" & Fields!B.Value & "'))"
Try changing "Reports" to "ReportServer" in your url.
For that just access this http://host/ReportServer/ and from there you can go to the report pages. There append your parmaters like this
&<parameter>=<value>
For more detailed information:
http://dobrzanski.net/2008/08/11/reporting-services-problem-with-passing-parameters-directly-in-the-url/
https://www.mssqltips.com/sqlservertip/1336/pass-parameters-and-options-with-a-url-in-sql-reporting-services/
http://desktop-qr277sp/Reports01/report/Reports/reportName?Log%In%Name=serverUsername&paramName=value
Pass parameter to the report with server authentication

Resources