Looking at setting up templates, and wondering if these can be accessed via url, instead of using UI.
something like calling template by name or id, eg https://mail.google.com/mail/u/0/#compose&template=HelloWorld
Seems unlikely but thought I'd ask in case there's a known method!
Thanks
Related
We work on a product that is a series of components that could be installed on different CMSs and provide different services. We take a CMS agnostic approach and try to use the same code in all the CMSs as much as possible (we try to avoid using CMS API as much as we can).
Some part of the code needs to work with the current URL for some redirections so we use Request.Url.ToString() that is something that has worked fine in other environments but in Kentico instead of returning the current page we always get a reference to CMSPages/PortalTemplate.aspx with a querystring parameter aliasPath that holds the real URL. In addition to that, requesting the Template page using a browser gives you a 404 error.
Example:
Real URL (this works fine on a browser):
(1) https://www.customer.com/Membership/Questionnaire?Id=7207f9f9-7354-df11-88d9-005056837252
Request.Url.ToString() (this gives you a 404 error on a browser):
(2) https://www.customer.com/CMSPages/PortalTemplate.aspx?Id=7207f9f9-7354-df11-88d9-005056837252&aliaspath=/Membership/Questionnaire
I've noticed that the 404 error is thrown explicitly by the template code when invoked directly. Please see below code from Page_Init method of PortalTemplate.aspx.cs:
var resolvedTemplatePage = URLHelper.ResolveUrl(URLHelper.PortalTemplatePage);
if (RequestContext.RawURL.StartsWithCSafe(resolvedTemplatePage, true))
{
// Deny direct access to this page
RequestHelper.Respond404();
}
base.OnInit(e);
So, if I comment the above code out my redirection works fine ((2) resolves to (1)). I know it is not an elegant solution but since I cannot / don't want to use Kentico API is the only workaround I could find.
Note that I know that using Kentico API will solve the issue since I'm sure I will find an API method that will return the actual page. I'm trying to avoid that as much as possible.
Questions: Am I breaking something? Is there a better way of achieving what I trying to accomplish? Can you think on any good reason I shouldn't do what I'm doing (security, usability, etc)?
This is kind of a very broad question so I was not able to find any useful information on Kentico docs.
I'm testing all this on Kentico v8.2.50 which is the version one of my customers currently have.
Thanks in advance.
It's not really recommended to edit the source files of Kentico, as you may start to run into issues with future upgrades and also start to see some unexpected behaviour.
If you want to get the original URL sent to the server before Kentico's routing has done its work, you can use Page.Request.RawUrl. Using your above example, RawUrl would return a value of /Membership/Questionnaire?Id=7207f9f9-7354-df11-88d9-005056837252, whereas Url will return a Uri with a value of https://www.customer.com/CMSPages/PortalTemplate.aspx?Id=7207f9f9-7354-df11-88d9-005056837252&aliaspath=/Membership/Questionnaire (as you stated).
This should avoid needing to use the Kentico API and also avoid having to change a file that pretty much every request goes through when using the portal engine.
If you need to get the full URL to redirect to, you can use something like this:
var redirectUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Request.RawUrl;
As per documentation of Microsoft.Automation/automationAccounts/modules (https://learn.microsoft.com/en-us/azure/templates/microsoft.automation/automationaccounts/modules#ContentLink) it's expecting URI parameter. What exactly supposed to be at the end of that parameter? I want to push my custom module and it's possible through UI via ZIP file and I expected that I can specify ZIP with custom DSC resource but it did not work. There is no documentation I was able to find what shall appear in that URI.
You need to provide uri to your zipped dsc module ;) There are a bunch of article online that you can salvage data from. Like this.
Also, take a look here
I am wondering if it is possible to configure an Azure Function App to accept a URI-path ID as is typically used in RESTful services, e.g. /api/foo/1, where the function is foo. I haven't been able to find documentation on this and the binding information that I have found suggests that this isn't possible (I don't see a way to map it). It doesn't "just work" with the typical HTTP trigger (which supports /api/foo?id=1). In that configuration one receives a 404 response, I'm guessing because it doesn't know to call the foo function with the ID suffix in the URI.
In case it matters, I'm using C# to write my function.
You are correct that URI parameters are not supported at this time. If you'd like, you can create a feature suggestion for this here in our repo. Thanks :)
What I would like to do is to programatically set my resources e.g. in GraphicImage and use for distribution e.g. dispatch images from other servers.
My thought was to extend the resource handler and depending on the library and id render the appropriate urls. Is that the way to go or is there a more elegant solution?
--update
The use case is the following: I have users that are uploading images/videos which I want to store in separate datastore and I also would like to have the ability to dispatch my js and css from other locations. The traditional way to do this to my knowledge is to have a front load balancer that handles the redirection but I would like to handle this on the application. One way to do this is to use full urls and set the base url in a configuration file and construct the full url. Another way which is what I would like to do is to extend the resource handler so that whenever I use a specific library eg.js or userimage to actually return a dynamic url so that I can easily set the location of my files. What I am not sure is if this is an good solution? If this has any implication and if there is simpler more elegant way to achieve the same result?
My requirement is when selection of a web resource one HTML page should appear with the content of that web resource.
So I thought I will add a plugin which will get the content of a web resource and dynamically create a HTML page.
now the problems I am having:
1) when the plugin should fire. because it should fire on selection of any web resource, and didn't show web resource in entity list in VS project using developer's tool kit.
2) How I can get the GUID of that selected web resource to get the content.
please guide me how I can do this. Is there any alternate way to do this?
Thank you.
It's a bit unclear what you mean but if I got the nature of your problem correctly, this is the answer to your question.
You're not supposed to use a plugin at all. Since this is an operation on the user interface only, JavaScript is the way to go here. You want to dynamically create contents in a IFRAME component and display those to the user. You should implement onsomeevent method and connect the clicking to fire it.
Accessing web resources is not done by their guids but through their name. At least when trying to access cross frame data stored in such a resource. The name is something that you set yourself when you create or upload the resource to the server.
May be i am wrong about this question.
Using JavaScript, you can achieve this as well.
In JavaScript, access selected WebResource with their name, and you can get details of that WebResourse by making an ActiveXObject.
var JScriptWebResourceUrl = "..Path Of WebResource/jquery.1.4.4.min.js";
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open("GET", JScriptWebResourceUrl, false);
xmlHttp.send();
eval(xmlHttp.responseText);
Now, you can do what you want from here.
Thanks,
Anish