How does one set Kentico SiteContext.CurrentSite property values? - kentico-11

Where in the admin interface or configuration does one set the values of the API SiteContext.CurrentSite property? grepping (well, actually findstring) the codebase and 30 minutes on Google has turned up nothing for me.

In the admin interface: Applications -> Configuration -> Sites, then click the edit icon (pencil)

Related

Publish editor add-on to G Suite Marketplace as internal (domain only) app for G suite

I developed a Google Form add-on and tried to publish it in the G Suite Marketplace as private (only for my G Suite domain) by following this guide.
I did this more than 2 days ago and the add-on is still not visible in the G Suite Marketplace, but the guide says:
If you selected Private visibility for the add-on, the add-on should become available for use after a few minutes.
So I think there is some issue here.
Earlier in October, the guide was different as the publication in Chrome web store was also required. The new guide has no more steps to publish to this Chrome Web Store so I did not do this.
Here are some ideas of the root cause of my issue (the fact that it's not visible in G Suite Marketplace):
Chrome web store is still required (but the guide says it's no more required). I have some doubt as this guide has been changed a couple of weeks ago.
In G Suite Marketplace SDK, the "publish" tab is may be also required? But the guide explains only the "Configuration" tab. Is this "publish" tab now required?
The guide is wrong?
I need to wait more time?
My guess is that the root cause is number 2. I guess the "publish" tab is required but the guide does not require this
Edit
When I was typing this issue here, the user guide was updated. Now I see that it's again required to publish the app to the Chrome Web Store, this has just been added : "Step 5: Configure the Chrome Web Store listing and publish".
It seems the user guide has been updated again, there is no more step 5.
I manage to get my private add-on available as a domain app after "forcing" the configuration page to save new settings. Here is how.
After the migration, the configuration page was set up but the publish page only show this message
Please setup 'Configuration' tab before publishing.
But on the configuration page, the save button was disabled as all the fields have been imported from CWS.
To enable the save button, I only had to change the privacy policy URL with a new one and save.
After that, the publish page showed the classic settings and I was able to publish the add-on. It appears on the GSuite Marketplace Domain App a few minutes after that.
I hope it helps.
In addition, but you may have done it already, the project is attached to my organization in GCP and it is marked as internal-only

Remove web properties by api (Google Analytics)

I need to remove web properties by api in GA. Here i read about beta for developers and requested access.
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webproperties
Answer was:
Analytics Writes Whitelist for project number xxxxx has been approved.
But a dont understand how to remove web properties. It will be method like management_webproperties->delete where i can read about it?
Unfortunately the API for Web Properties does not support the delete method [reference]
Depending on what you are trying to achieve, there are some potential workarounds:
Rename the property to something like "z (Archived) Property Name" so that it appears at the bottom of the list of properties for a user.
Delete all views under a property. The property will still exist, but will be "empty".

What is the best IFormatProvider for Logging?

I have an installable ASP.Net application that is logging using Common.Logging.
When writing log messages ie:
_log.InfoFormat(CultureInfo.???, "{0}: Writing to the Log", DateTime.UtcNow);
I am confused about which culture I should be using. The result I want is that the log messages are formatted using the server's regional settings. That way when administrators install the application they have control over how their log messages are formatted.
There are fours options but none seem to be the correct choice:
CultureInfo.CurrentCulture: this seems like it would be the correct choice for a windows app but ASP.Net is changing this to match the user browsing the site - so it's appropriate for formatting content to display to the user but not for writing to the log.
CultureInfo.CurrentUICulture: similar problems to CurrentCulture - will match the current user browsing the site.
CultureInfo.InstalledUICulture: the system installed culture - appears to relate to the copy of windows installed but not alterable by the user. Apparently this one is a bit useless
CultureInfo.InvariantCulture: this is not user configurable. I am wondering if this is the best of the four options here though because at least it is consistent and won't vary by who is browsing the site/the media windows was installed from.
I am left wondering if I need to add explicit configuration in my web.config for the system culture so the installer can choose a culture. The answer I really want is whatever CultureInfo.CurrentCulture was before ASP.Net changed it to match the current user.
Note: I know I can turn off ASP.Net changing the CurrentCulture per user but the UI relies on this behaviour.
Admins like to have control over the logs. Telling them to go configure their server culture so that the logs are in a particular format doesn't seem like the best solution to me.
Adding a configuration option into web.config is a good idea. This will let the admin configure the log format as required.
Rather than ask the user, you could make an intelligent guess while installing using CultureInfo.CurrentCulture. If the user wants it to be something different, he can always change it.
If you do want to take it from CultureInfo.CurrentCulture rather than configuration, you can pick it during the Application_Start event, and keep it in the application context.

MS Chart not showing on hosted site

I have a MS Chart component displaying fine on an ASP.Net page. When I deploy it I get a broken image. The settings in the web.config are the same and the temporary images folder has the correct permissions.
When I get the URL of the images I can see that the /.png file is not getting created.
What sort of things do I need to look at to track down the problem?
I was able to resolve the issue by ensuring that my application pool settings was using "ASP .net integrated" and not "ASP .Net Classic". This will ensure that your handler is being used.
I had the same problem when I was working with the charting in .NET 4 and my problem turned out to be related to the default value of the privateImages attribute and the fact that my code wasn't using any identifying attributes for the session or the user.
See my post here for an explanation of how I solved my problem.
It's also worth noting that the ASP.NET Development server ignores the config settings for charting and renders them in memory unless you specifically set an attribute to force it to use your config.

How can I create and manage a multi-tenant ASP MVC application

I want to create a multi-tenant application that uses the hostname to determine the customer.
For example:
CustomerOne.myapp.com
AnotherCo.myapp.com
AndOneMore.myapp.com
...
I can do the database and security side with no problems, I can also get the hostname from the URL, but what I am struggling to find out is how to create the basic plumbing that would allow a new customer to sign up online, provide their company name, and for the application to create the new URL, ready to be used straight away.
Can anyone help?
Thanks,
Rob.
I can't answer this exactly, but I can break it down a little bit.
To set up a new generic subdomain something.myapp.com you'll need to do two things:
1) Programmatically add some new DNS entries via your ISP so that something.myapp.com points to your web server.
2) Programmatically set the local bindings in IIS so that something.myapp.com gets directed to the right website/virtual directory/application
There is some discussion of setting IIS binding programmatically here, which also links through to this forum post here, which mentions that appcmd.exe can be used to set IIS config at run time.
Hope this points you in the right direction ...

Resources