custom pipeline on time of browsing a page - sitecore

I want to call a LayoutResolver custom pipeline on time of browsing a page.
For that i created a custom pipeline and configured as below
<httpRequestBegin>
<processor patch:after="*[#type='Sitecore.Pipelines.HttpRequest.LayoutResolver, Sitecore.Kernel']"
type="Agents.Common.PipeLines.LayoutResolver, Agents.Common" />
</httpRequestBegin>
But its not working on time of browsing a page but its working when i am clicking any even from sitecore .
How it will work on time of browsing a page.

Based on the patch syntax you provided, it looks like you have configured your LayoutResolver to run after the existing LayoutResolver.
Were you intending instead to replace the existing resolver? Or to run your logic before it?
For replacing, you will want to use patch:instead. For running before the existing resolver, you will want to use patch:before

Regardless of how your processor is configured, the HTTP request begin pipeline executes for most if not all Sitecore requests - even shell ones, which I think is what you refer to in your question.
The easiest thing to start off with would be to verify that the context site is website (or whichever Sitecore site you want to affect) and anything else that might distinguish requests you want (e.g. page mode).

Related

Access/Substitute CreatePage outside of Gatsby-node.js

I am creating a forum using Gatsby
I have develop a form that users can use to create threads to add to the forum in a page called create.js which which sends the data to an external DB.
Once, the user has submitted the thread, I want to create a new page using a template, normally I would use in Gatsby-node.js; according to the Gatsby Docs Gatsby-node.js is only run once on deployment.
Is there another way that I can access CreatePage() outside of Gatsby-node.js or is there another function I am missing?
Ultimately I want the new page to available in the Gatsby application, without redeploying, after the user has created the necessary content.
The way Gatsby works is that all pages need to be generated at build time. You cannot add new pages without triggering a new build.
Gatsby is not a suitable platform for a forum since content changes hundreds or thousands of times a day. Gatsby is intended for content that changes infrequently such as blogs (which might update a few times a day).
I order to generate pages without using CreatePage in Gatsby-node.js, Gatsby advises to use #reach/Router and matchPage to extend the client application's router, we call this functionality (Client-only Routes)
more info here

Sitecore 7.2 Item Web Api - Unable to PUT html text

I am trying to update (using PUT operation) a sitecore item with a 'Rich Text' field with the Sitecore ItemWebApi 1.2. I am running in to an issue with the server saying
"A potentially dangerous Request.Form value was detected from the client"
I could do the validationRequest=false in the web.config. But that will disable the validation for all requests which is not ideal. Is there a way to save html text using ItemWebApi without using the validationReques=false? Seems for aspx pages you could use #Page. Not sure where something like that could be configured in this case.
May be you have already figured out the answer for yourself, but in interest of our fellow community I posting answer here.
Actually myself get struck into this similar issue from last week, but because of your question i found the solution.
By Default Sitecore nowdays comes with
<pages validateRequest="false">
but it is not effective until or unless we do following
<httpRuntime requestValidationMode="2.0"/>
It is also indicated in Sitecore KB article and in another stack overflow answer.
Regards
Vishal Gupta
I did double escaping on client before sending to server and double unescaped with a custom item web api processor to essentially achieve the same effect for this one ajax call. This way, I did not have to turn off validation application wide and had to add the validateRequest=true on all pages. Turning of default html validation would also mean every other developer on our team needs to be aware that html validation is turned off and they have to add special xml on top to enable it. Someone missing that will make our site insecure.

How do I add a custom .aspx page to sitecore?

I've recently created an aspx and aspx.cs page that needs to run alongside a sitecore website. Does anyone know how i can add these pages into the site? Our set up is very odd and would like to know recommendations before trying anything and risking breaking our setup.
You don't necessarily have to add your page to the IgnoreUrlPrefixes.
Before the ItemResolver is executed, the FileResolver is executed which checks if your request points directly to a file on disk.
You do need to configure the allowed URL extensions in the FilterUrlExtensions processor of the preprocessRequest pipeline, as such:
<preprocessRequest
<processor type="Sitecore.Pipelines.HttpRequest.FilterUrlExtensions, Sitecore.Kernel">
<param desc="Allowed extensions (comma separated)">aspx, ashx, asmx</param>
<param desc="Blocked extensions (comma separated)">*</param>
</processor>
</preprocessRequest>
So that configuration will allow *.aspx, *.ashx and *.asmx to be requested directly (it's the default configuration in Sitecore 7.0).
If you're using Sitecore 6.6 or lower, the FilterUrlExtensions processor can be found in the httpRequestBegin pipeline.
If you just drop the ASPX page in at the path you'd like it to reside, by default, Sitecore should let it be served as is by going to the corresponding URL.
Just add the pages to the projects as normal (as DustinDavis suggested) but you also need to modify IgnoreUrlPrefixes in web.config (or add a config patch file) and include the pages or folders as pipe delimited values that you want the Sitecore handlers to ignore.
You can configure the value attribute of the
/configuration/sitecore/settings/setting element in web.config with
name IgnoreUrlPrefixes to prevent Sitecore from processing specific
requests, causing ASP.NET to process the request without Sitecore.
From Sitecore Presentation Component Reference
There is more information about the how and why in this blog post by Alex Ahyba
If you have sitecore open in Visual Studio, just add them in to the project. You can access the new page directly.

Is there any way to administer multiple Django servers at once?

Short Version
Is there any tool that will let me use a single Django admin page to affect multiple Django installations on different servers?
Detailed Version
I've got a bunch of different servers, each with their own Django installation. This works great ... except when I want to do something via the Django admin to all of the servers, in which case I have to log on to each server separately.
For instance, let's say I have a release coming and a co-worker (who's not a programmer) wants to use the admin to make a "message" record about the release for the server's users to see. They have to log in to each server's admin individually, create the message record, then move on to the next server until they've gotten through all of them.
To get around this whenever I have a multi-server change I've been using Git; ie.:
I make a commit with files for the change
I push that commit
I pull that commit on all of the servers at once (using Fabric).
However, this too is sub-optimal, because we can't take advantage of the admin interface, and doing something as simple as adding a "new release coming" message requires an actual (mini-)release itself.
So, it seems to me the best way to handle this would be if there was some sort of meta-admin tool my co-worker could use to Django admin work on multiple servers at once. Does anything like that exist?

Missing Webforms for Marketers Data

I'm attempting to troubleshoot a Sitecore system that has the Webforms for Marketers module installed.
I have submitted a contact form from the front-end but when I look at the form reports, there is only legacy data on the "Data" tab. If I look in the "Usability Report" tab, I can indeed see my submitted data.
There are several save actions set up, one of which is the Save to Database, and another is Send Mail. Neither seem to be firing.
Since the data is under the Usability report, it would seem that something is working but I'm not sure how to troubleshoot where the issue originates from.
One key piece of info is the site has recently been moved from one server to another. The connection strings work as far as I can tell, however. Also, there is no CD/CM separation, just a Master => Web publishing setup, though it seems like at one time before I got my hands on it, there was a staging server. Like I said though, the connection strings seem in order.
Any ideas?
Turns out I think it did have to do with a previous staging server. I removed the following from ConnectionStrings.config
<add name="remoteWfmService" connectionString="url=http://{mysite}/sitecore%20modules/shell/Web%20Forms%20for%20Marketers/Staging/WfmService.asmx;user={myuser};password={mypass};timeout=60000"/>
Once that came out, everything started working as expected.