Quantcast
Channel: DevNet Questions
Viewing all 11888 articles
Browse latest View live

Kentico 12 - Limit Page Selector by a given page type

$
0
0
Is it possible to limit the new widget Page Selector by a given page type? I know you can set it to load a specific path using EditingComponentProperty(nameof(PageSelectorProperties.RootPath) but can't see a way to limit by page type.

Finding the NodeAliasPath after retreiving a node/page type

$
0
0
Hi, I am attempting to find the NodeAliasPath from within a controller and am having some issues. I have tried using the following code snippets which I found on this forum.// Ways to get current page string nodeAliasPath = CurrentDocument.GetValue(@NodeAliasPath@).ToString(); string nodeAliasPath = CMS.DocumentEngine.DocumentContext.CurrentAliasPath; // Ways to get parent page string parentNodeAliasPath = CurrentDocument.Parent.GetValue(@NodeAliasPath@).ToString(); The idea is to get the NodeAliasPath dynamically and to use it to get the content for nested pages etc...My question is, when and where is the Node Alias Path available? I have tried calling it in models, views, controllers. It returns null or empty string every time.I can see in the CMS that it does exist, and I can even use a hard coded alias path in my code, but it won't find it dynamically.This is an example of how I am trying to get it in the controller. I feel like I'm not thinking about this in the Kentico way.ThanksPeoplePage peopleNode = PeoplePageProvider.GetPeoplePage(@/ADIA-People@, @en-us@, @Adia@) .Columns(@DocumentName@, @Title@, @Heading@, @Copy@, @Image@); ViewBag.aliaspath = peopleNode.NodeAliasPath;

Hierarchical viewer find if item has sublevels

$
0
0
Hello, i would like to know if it is possible to someway find if an item inside a Hierarchical viewer has sublevels under it, in order to be able to alter it's transformation accordingly from a javascript function. Thanks in advance!

How to assign site for new user via Kentico API

$
0
0
I'm trying to create a new Kentico user and assigning them to a site, via Kentico API: https://docs.kentico.com/api11/configuration/users#Users-AssigningausertoasiteIn my case SiteContext.CurrentSiteName returns empty string. I thought of trying by hard coding the site. UserInfor newUser = new UserInfo(); //...set all required properties... //add user to site UserInfoProvider.AddUserToSite(newUser.UserName, "My Site Code(or Display) Name"); //save user UserInfoProvider.SetUserInfo(newUser); Tried both Display Name as well as Code Name of the site in UserInfoProvider.AddUserToSite, but the user is not getting assigned to the site on Kentico site. It does get created with all the properties.

Developers who have used stackoverflow for Job hunting, how was the experience?

$
0
0
Hey everyone, I found my previous and current job on Stack Overflow. The former used Stack Overflow's built-in application and messaging system to take applications, and to respond initially, then we moved to email. The latter sent me to the company's career page for an application there, they then replied directly to the email address on my application.I think Stack Overflow probably has some of the highest quality job postings. It seems like most of the postings are likely to have been put there either by technical people on the team with the opening, or at the request of that team--this was the case for the two jobs I describe above.

How to exclude UNPUBLISHED documents from Azure Search Index

$
0
0
We have realized that regardless of whether pages are published or not published, Azure Search will include them within its index. Any way to exclude them, we dont see any option within Kentico's Smart Search module or the Page/Page-type modules. We dont want to have to unpublish a document and also have to remember to check the @exclude from search checkbox@. We expect it to automatically exclude it since it is not published.Thanks!

DocumentHelper.GetDocuments() with Columns() method doesn't limit columns returned by SQL correctly

$
0
0
Hello,When we use the DocumentHelper.GetDocuments() with the Columns() method, e.g. var resultsQuery = DocumentHelper.GetDocuments() .Types( @Company.Type1@, @Company.Type2@ ) .Columns( @DocumentTitle@, @NodeAliasPath@ ) .WhereIn( @NodeAliasPath@, new string[] { @/home/page1@, @/home/page2@ } ); var sql = resultsQuery.GetFullQueryText(); The generated SQL selects all columns from the Type1 and Type2 tables, not just the ones I've specified above (including the full HTML of the page). I feel like I must be missing something here or this is just a major bug. If I change the query to use the DocumentHelper.GetDocuments(@Company1.Type1@) method instead, again specifying the columns I want, then the SQL query correctly limits the columns returned. But I'd rather not have to iterate over each page type performing individual queries and combining the results or use some manual UNION query to get the result I want. According to the documentation, the above query should work.We are using the latest version of Kentico (12 SP, version 12.0.2000.8) on an MVC site.What am I missing or what do I need to change to get the expected behavior?

macro in autoresponder

$
0
0
Hi Everyone, I am trying to get a value form a page that submitted the form. Indiviually the quiries return values, I am trying to string them together using parameters. I have some success in the conoule app, but when inserting the code into the autoresponder on the form I get an error @An invalid WHERE condition was used@. Here is the code: {% Documents[@/@ + {Documents.Where(@NodeId = @ + {CurrentDocument.GetValue(@SeminarID@)})[0].NodeAlias}].Fields.SeminarTime #%}CurrentDocument.GetValue(@SeminarID@) returns 582Documents.Where(@NodeId = 582@)[0].NodeAlias returns the node alias @xxx-xx-xx@Documents[@/xxx-xx-xx@].Fields.SeminarTime return the time 6:00 pmAm I doing soming wrong or not using parameters correctly?Thanks for any feedback!

Issue with deploying to Azure App Service from Visual Studio

$
0
0
Hi all,I am trying to deploy my Kentico site to Azure through Visual Studio as a little teaser of what is to come down the line with real deployment.I first created an empty database (and db server) through Azure. I am able to connect to this through Microsoft SQL Server Management Studio 18. From here the user that I created at the time of making the db server has full access to create tables etc...seems like there is no issue.I have changed the db connection string in web.config with the string straight out of azure database dashboard.I also tried this string format from a kentico tutorial as it appears slightly different to the one from the dashboard...@connectionStrings@ @add name=@CMSConnectionString@ connectionString=@Server=DATABASE_SERVER.database.windows.net;Database=DATABASE_NAME;User ID=DB_SERVER_USER_NAME;Password=DB_SERVER_PASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=120@ /@ @/connectionStrings@ I then go to publish the app from Visual studio, create a new app service and connect to the existing db.This is the error I am getting after I publish from Visual Studio...Cannot access the database specified by the 'CMSConnectionString' connection string. Please install the database externally and set a correct connection string. Alternatively, you can use web.config key CMSWaitForDatabaseAvailable or set property CMSApplication.WaitForDatabaseAvailable prior to the API initialization to let the application intentionally wait until the database is ready. Interestingly, when I change the password in the connection string (making it incorrect), it spits out this message:Login failed for user 's1t2'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: CMS.DataEngine.ApplicationInitException: Login failed for user 's1t2'. This makes it seem like the login credentials are working to some extend when I am receiving the CMSConnectionString error...Thanks in advance for any help

Kentico 12 - Recaptcha and BizForms

$
0
0
I've been successful in setting up a custom form in my views utilizing some built-in Kentico HTML Helpers. Been using @Html.TextAreaFor(), @Html.CheckboxFor(), etc. All data is being passed through a model and getting saved to the database via BizForm. Just to note, I am not using PageBuilder for the form.Now, maybe I'm trying to do something that's not even supported because I don't see it in the documentation. However, is it possible to call the Recaptcha field with a similar built-in method (i.e. @Html.RecaptchaFor())? If so, what is the method/namespace for it? If this is simply not possible, I'll implement it a different way. Just want to ensure there isn't a better way of doing this.Appreciate any feedback and implementation suggestions, thank you in advance.To help provide some context, below are the namespaces currently being referenced in web.config, which don't seem to inherently support displaying Recaptcha: @add namespace=@Kentico.Content.Web.Mvc@ /@ @add namespace=@Kentico.Web.Mvc@/@ @add namespace=@System.Web.Mvc@ /@ @add namespace=@System.Web.Mvc.Ajax@ /@ @add namespace=@System.Web.Mvc.Html@ /@ @add namespace=@System.Web.Optimization@/@ @add namespace=@System.Web.Routing@ /@

Custom Fields for Activity Types

$
0
0
(for Kentico 11 EMS version, Portal Engine)Can we add custom fields to an Activity Type? It looks like this can be done through the Activity module (Activity @@ Classes @@ Activity Type @@ Fields). Our client would like to add additional description fields to their activity recordsCan this safely be updated in the Activity module or will changes cause issues with other marketing modules/process?Thanks for your help

Kentico MVC culture issue

$
0
0
I have a multi culture website on Kentico MVC version 12, and I have some odd behaviour. In my website I have english and French, the issue is on the French.When I view the page in the browser I don't see my French changes, but when I click the @Preview URL@ under the @general tab@ I do see the changes.Can someone please advise for solution?Thanks

Permissions for custom module

$
0
0
Hello guys,I have set on editor(user) the permission to modify and read a custom module but on the editor(user) dashboard the module is not appearing.Thank you.

Possible bug in CMSModules_Membership_Controls_ResetPassword

$
0
0
I think I may have found a bug in CMSModules_Membership_Controls_ResetPassword, particularly in the OnLoad method.Everything seemes to go well till I hit these lines: if (!RequestHelper.IsPostBack()) { if (policyReq @ 0) { ShowInformation(GetString(@passwordpolicy.policynotmet@) + @@br /@@ + passStrength.GetPasswordPolicyHint()); } UserInfo ui; // Get user info int userId = GetResetRequestID(); if (userId @ 0) { // Invalidation forces user info to load user settings from DB and not use cached values. ui = UserInfoProvider.GetUserInfo(userId); ui?.Generalized.Invalidate(false); } else { ui = UserInfoProvider.GetUsersDataWithSettings() .WhereEquals(@UserPasswordRequestHash@, hash).TopN(1).FirstOrDefault(); } // There is nobody to reset password for if (ui == null) { return; } // Validate request ResetPasswordResultEnum result = AuthenticationHelper.ValidateResetPassword(ui, hash, time, interval, @Reset password control@); // Prepare messages string resultMessage = string.Empty; // Check result switch (result) { case ResetPasswordResultEnum.Success: // Save user to session SetResetRequestID(ui.UserID); // Delete it from user info ui.UserPasswordRequestHash = null; UserInfoProvider.SetUserInfo(ui); break; case ResetPasswordResultEnum.TimeExceeded: resultMessage = DataHelper.GetNotEmpty(ExceededIntervalText, String.Format(ResHelper.GetString(@membership.passwreqinterval@), URLHelper.AddParameterToUrl(securedAreasLogonUrl, @forgottenpassword@, @1@))); break; default: resultMessage = invalidRequestMessage; break; } once it sucessfully grabs the userinfo, it then removes the hash. Ok, all well and good, but then when the user attempts to reset their password there is no hash for the function: string resultText = AuthenticationHelper.ResetPassword(hash, time, userId, interval, passStrength.Text, @Reset password control@, emailFrom, siteName, null, out success, InvalidRequestText, ExceededIntervalText); to interact with, thus it returns an invalid result.I attempted to return the hash to the database record before pressing the button and it processed the request successfully.So is this a bug, or am I doing something wrong?

Working with Product Options and Variants in MVC

$
0
0
Hello,I'm running Kentico 12 MVC and I'm trying to implement product options (e.g. accessories) into my ecommerce solution. The Dancing Goat website and the Kentico documentation provide a good example of how to use variants with Product Attributes, but I couldn't find an example for product options of type Products.I entered the possible options into Kentico and the Kentico UI allow me to select all the different options as expected. My only trouble is getting it to work inside the MVC project.I'm already able to query the options for a specific parent SKU:var skuOptions = OptionCategoryInfoProvider.GetProductOptionCategories(parentSkuId, true, OptionCategoryTypeEnum.Products); I have to call this method with the parent SKUID. I haven't figured out how to actually add the selected product variant with the selection option (accessory) to the shopping cart.Is there an example somewhere?Thanks

Kentico session data with Azure Redis cache

$
0
0
Hi all,I have a question about the using the Azure Redis cache to store the Kentico session data. We have multiple app services in different availability zones running the website, and each app service has the potential to scale out to multiple instances. The questions are:Do we need one redis cache service for each app service we have, or only one for all the app services for best practice?We haven't implemented using redis cache for caching. If we do that, is the answer still the same?We are also using a Azure storage account to store the media files. Do the answers from above apply on it as well?Thanks!

Check security error event

$
0
0
Few days ago, my website log quite much event like thisSecurity check of the expression 'Settings.CMSEnableTranslations|(user)Dung.vo-viet|(hash)e7a62c4b827f3412e5b8f9b02a0dfebcad1647219d914df4911a702d10edec6b' didn't pass. The expression was signed by user 'Dung.vo-viet' which either does not exist or does not have permissions for the expression evaluation. Create the user and/or assign them proper permissions for the expression evaluation or remove the signature and re-save the expression by a user with proper permissions or proper macro identity assigned.Event user name is administrator account. I want to know why this happened and how to resolve it. Thanks.

Kentico - How to remove illegal characters from media path?

$
0
0
I'm trying to use an html template to a PDF generator. However, i'm getting an error on the file path name, saying that there are illegal characters on it. File path: ~/file/relative/path.pdf?ext=.pdfIt's clear that the file path contains ? that causes this error. The error can be resolved by removing the ?ext.pdfIs there a method in Kentico that removes the ?ext.pdf? My last resort is to write a regex to get rid of it. Hoping that there's a built-in functionality that can do this. Thanks in advance!

Error generating web analytics

$
0
0
I have meet an error when opening web analyticsError detail:Message: A generic error occurred in GDI+. Exception type: System.Runtime.InteropServices.ExternalException Stack trace: at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) at System.Web.UI.DataVisualization.Charting.Chart.SaveImage(Stream imageStream) at System.Web.UI.DataVisualization.Charting.Chart.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) at CMS.Base.Web.UI.ContextMenuContainer.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at CMS.Base.Web.UI.AbstractUserControl.Render(HtmlTextWriter writer) at CMSModules_Reporting_Controls_ReportGraph.Render(HtmlTextWriter writer) The report can't show the chart. How can i fix this. Thanks.

How to get DocumentAttachment field when limiting a query by Columns

$
0
0
I am trying to get a page node that has a Document attachment but when I limit the query by columns the model comes back with a null for the Image field. The view model has an Image property of type DocumentAttachment and it is being set like this: public string DocumentName { get; } public string PeopleTitle { get; } public string PeopleHeading { get; } public string PeopleCopy { get; } public DocumentAttachment PeopleImage { get; set; } public string PeopleNodeAliasPath { get; } // Maps the data from the page type's fields to the view model properties public PeoplePageViewModel(PeoplePage peoplePage) { DocumentName = peoplePage.DocumentName; PeopleTitle = peoplePage.Fields.Title; PeopleHeading = peoplePage.Fields.Heading; PeopleCopy = peoplePage.Fields.Copy; PeopleImage = peoplePage.Fields.Image; PeopleNodeAliasPath = peoplePage.NodeAliasPath; } And this is the code from the controller where I am trying to find the page/node and create the model.PeoplePage peopleNode = PeoplePageProvider.GetPeoplePage(@/ADIA-People@, @en-us@, @Adia@) .Columns(@NodeAliasPath@, @DocumentName@, @Title@, @Heading@, @Copy@, @Image@); var peopleModel = new PeoplePageViewModel(peopleNode); Any ideas how to improve the column query as including @Image@ isn't working even though that is the exact field name in the page type.Thanks
Viewing all 11888 articles
Browse latest View live