Retrieving published URL of a Tridion page based on URI - tridion

Does anyone know if we can retrieve the published URL of an SDL Tridion Page based on the URI? Ideally I would like to do this using the Core Service.

If you are talking about retrieving a Page's published URL, it can be done via:
PageData page = client.Read("tcm:12-345-64", null) as PageData;
PublishLocationInfo info = (PublishLocationInfo)page.LocationInfo;
string url = info.PublishLocationUrl;

Related

Vaadin Flow: How to get current URI

I need to get the current servers name an all the other information stored in the URI.
In Vaadin 8 it was accessible thru the Page by calling something like this:
URI uri = Page.getCurrent().getLocation();
In Flow the Page does not contain such information:
An neither does the Router afaik.
How do I get the URI?
Thank you in advance.
Update Feb 2021
Since Vaadin 19 there is a new Page method called fetchCurrentURL which will actively poll the current url form the frontend.
see: commit
Old an potentially problematic workaround
The URI can be retrieved using this:
VaadinServletRequest req = (VaadinServletRequest) VaadinService.getCurrentRequest();
StringBuffer uriString = req.getRequestURL();
URI uri = new URI(uriString.toString());
There is no direct way of doing this, but a feature request is open for this case: https://github.com/vaadin/flow/issues/1897.

asp.net mvc soap request

i have URL like this : https://soapserver.example.com/blahblah.asmx?wsdl
i need to send some params to the this URL and get response.
1 - i created asp.net mvc project
2- Generated Service reference - Project > Add Service Reference > Submited URL
3 - edited controller like this
PromoKontrol.ServiceSoapClient ProKontrol = new PromoKontrol.ServiceSoapClient();
ProKontrol.PromosyonKoduKontrol(UserName, Password);
i am using breakpoint but i cant see any response?
Please make sure you assign the data returning from the service to some variable.
In the below code keep the debugging point and check the returnDate;
PromoKontrol.ServiceSoapClient ProKontrol = new PromoKontrol.ServiceSoapClient();
var returnDate = ProKontrol.PromosyonKoduKontrol(UserName, Password);

Calling Flipkart Api in asp.net c#

I am calling flip kart API in asp.net c# .But i got following error : 401 authorization.
I already included flip kart token and affiliate Id in Rest Header as per Prerequisites and category
URL also.So please tell me why i am getting this error. I am Calling RestApi using HttpClientRequest and my asp.net framework is 4.0
First you need to get product category link list by simple 'Get' using URL
https://affiliate-api.flipkart.net/affiliate/api/<your-affiliate-id>.<json or xml>
the response will have list of various categorizes and their url. These urls require HTTP authentication headers (your affiliate-id and access token) in the GET request. You can add like :-
WebClient wc = new WebClient();
wc.Headers.Add("Fk-Affiliate-Id", "blueskyvic");
wc.Headers.Add("Fk-Affiliate-Token", "your access code");
string res = wc.DownloadString("https://affiliate-api.flipkart.net/affiliate/feeds/blueskyvic/category/v1:6bo-ul6.json?expiresAt=1420832915393&sig=6c1167c0d141bd3edab28f9f2a980a30");//tv_video_accessories
The response will have nexturl property which will give you listing of next 50 items in that category.

Can I take the SessionID returned from the SOAP API and use it in a URL Access call to SSRS?

Two things; first is I keep getting a 401 exception on the last line. I had thought that re-using the session would allow me to not only NOT have to resend the credentials but would also let me access the report by URL. It does neither...
Second, what do I do with the response once I have it to display it in the browser for the User?
This is what I have so far but I am unsure where to go with this from here....
var rs = new ReportExecutionService.ReportExecutionService();
rs.Credentials = new System.Net.NetworkCredential("UserID", "Pswd", "myDomain");
var execInfo = rs.LoadReport("/Nav Reports/OpenSalesOrderByCustomer", null);
var format = "HTML4";
string requestUri = string.Format(
#"https://reports.myServer.com/ReportServer/?{0}&rs:SessionId={1}&rs:Format={2}",
execInfo.ReportPath,
execInfo.ExecutionID,
format
);
WebRequest request = WebRequest.Create(requestUri);
request.UseDefaultCredentials = false;
request.Credentials = new System.Net.NetworkCredential("UserID", "Pswd", "myDomain");
var response = request.GetResponse();
For Background info -->
I am trying to setup Remote Report processing with SSRS on my asp.net web forms app. I would simply use the Report Viewer control but it's hideous looking and not acceptable to our user base. The URL Access returns a much better looking and formatted report and is acceptable but I have to pass Security Credentials. I would use SOAP API except it returns a non-styled html 'blob' and also removes the Toolbar functionality that we want to use.
So, I seem to be left with figuring out a way to use the SOAP API to authenticate a session and then somehow use that to use URL Access.
Just call the SOAP API, get the bytes, and return those bytes to the user with appropriate headers, content-type: application/pdf, content-disposition:attachment;filename=report.pdf. You don't need to do multiple calls to the report server.

Building querystring in routing webforms .net 4.0

I'm trying out .net 4.0 routing with Webforms for the first time and I'm running into a problem. The page I'm routing to is looking for a querystring based on the route url.
For Example:
routes.MapPageRoute(
"Rule2", // Route name
"news/{day}/{month}/{year}/{.*}.aspx", // Route URL
"~/mynews.aspx" // Web page to handle route
);
I want the final route to send mynews.aspx?story={day}{month}{year}. But I can't figure it out. I found this to be some help http://msdn.microsoft.com/en-us/library/cc668177.aspx but request.querystring("story") gives me nothing.
Any words of wisdom?
Normally you wouldn't have 'aspx' in the route URL because you'd want a user friendly one. So, the route URL would be "news/{day}/{month}/{year}/{.*}" and a valid URL 'news/25/5/2012', for example.
Then to access the data you use
string day = (string) RouteData.Values["day"].

Resources