Questions tagged [controller]
For questions specifically related to the use of MVC controllers with Sitecore. This tag should not be used for general .NET MVC controller questions.
33 questions
0
votes
5
answers
408
views
ServiceAPIController No HTTP resource was found that matches the request URI
In SC 10.1.3, we are trying to access a Controller inherited from ServiceAPIController, but receiving a NO HTTP Resource Found error.
We introduced the config and controller as below
<processor ...
1
vote
3
answers
140
views
Lost All Layout After MVC Form Postback to Controller Rendering
I need to develop a controller rendering to do a simple search functionality. The UI has a search box and a search button, after postback, I will have some logic to get the result and show back to ...
1
vote
1
answer
169
views
Sitecore Controller MVC Redirect takes me to base URL instead of specified path
I am having an issue in Sitecore where when I try to redirect to a particular page from within a Controller, it takes me to the home URL of the website instead of the path that I am specifying.
This ...
1
vote
0
answers
4k
views
An error occurred when trying to create a controller of type 'MapController'. Make sure that the controller has a parameterless public constructor
I'm working on an upgrade from Sitecore 8.2 to 10.1, and I've got some API Controllers. These worked in the 8.2 site but I'm encountering dependency injection issues now, getting the following error ...
1
vote
2
answers
323
views
Where to find the Controller Folder(Source File)
I am a beginner in programming and Sitecore. And I would like to create a Controller using C# to handle some business logic. But I cannot find any backend source files of Sitecore. Could someone tell ...
0
votes
0
answers
128
views
Can we create multiple ActionResults in Sitecore SXA custom controller rendering?
Per Sitecore SXA documentation, in SXA custom controller, we have to override the GetModel() method and we call repository to get the model. I would like to create multiple Action Results in Sitecore ...
1
vote
1
answer
328
views
Is there any way to update the response of a controller action by pipeline process?
Is there any way that I can update the response of a controller action by pipeline process?
In httpRequestEnd or httpRequestBegin for example
P.S:
I'm using Sitecore 9 update 1 included EXM. I created ...
2
votes
2
answers
450
views
Loading of new page blocked by api call
I have a website with two pages (A and B). Both have some content which is loaded via renderings. A has a button which opens B in a new tab. A also has some frontend code which calls one of my APIs, ...
1
vote
2
answers
597
views
Debugging in VS
Is there a way to debug in Visual Studio, particularly when working with controllers? Whenever I try, I get a message that says, "Unable to start debugging on the web server. The debugger cannot ...
1
vote
1
answer
1k
views
Html.Sitecore().Rendering() causes: Attempt to retrieve context object of type 'System.Web.Mvc.ViewContext' from empty stack
We have a web controller inside our Sitecore 8.2 Site that returns a search box view. The controller is exposed as an API endpoint like so: {url}/api/search/large/
When making an http web request to ...
4
votes
1
answer
373
views
Context.Site.Name changes to wrong site when using AJAX call
I'm using Sitecore 9.1.1, and a multisite setup.
I have a custom controller rendering that I view from a page in Site2, my controller had 2 methods: an Index() method that returns the view, and a ...
5
votes
2
answers
3k
views
How to pass rendering parameters for a static controller rendering
There is need to load a controller rendering from the Razor view.
I'm doing it this way:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new { RedisCacheKeyPrefix = "scans_", ...
0
votes
0
answers
376
views
Returning a file stream from a Controller
I have pdf files in folder, I want user enable to download file, in MVC controller its quite simple as below
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, filename);
but ...
1
vote
1
answer
712
views
OutputCache with a Sitecore controller
Using Sitecore 9.0.2, I've got code in two areas: SitecoreComponent (for controller renderings) and API (for JS calls). I've got a controller that inherits from SitecoreController in the API folder ...
0
votes
1
answer
2k
views
Any Best way to call the MVC action method from Hyperlink
Currently, we are having a hyperlink tag and the MVC action method is called directly from hyperlink as
<a href="/api/sitecore/{controller Name}/{action Name}"> Hyperlink Text
While hovering ...
1
vote
1
answer
301
views
How to check access right in SitecoreController for Sitecore 9.1
In my JSON controller I want to check the access right from the User.
My code looks like this
public class MyController : SitecoreController
{
public static bool CheckAccessRight()
{
...
2
votes
3
answers
795
views
Sitecore 8.1 Controller Rendering Error
I am a newby and working on the Solutions Developer Course for Sitecore 8.2 online in Visual Studio with Sitecorerocks. Also just a heads up, very recently I had to rebuild this Visual Studio 2015 ...
1
vote
0
answers
258
views
Getting SitecoreControllers Working With Swagger
Is there a good way to get Swagger to work with controllers that inherit SitecoreController? I've checked this blog out which uses controllers that inherit from ApiController. I thought I could get ...
2
votes
2
answers
2k
views
Sitecore support for async controller renderings
I am planning to use ASP.NET async pattern in my Sitecore project, but I'm getting the error:
Asynchronous method which returns task as result cannot be executed synchronously
Is there a way to ...
0
votes
1
answer
2k
views
FieldRenderer.Render for controller Rendering not "working"
I am trying to create a controller Rendering with the use of FieldRenderer.Render, but this does not work.
The Controller
public ActionResult PageImage()
{
return View(PageImageModelBuilder....
8
votes
1
answer
635
views
How to Connect controller rendering with Interface Template
I am trying to create a simple Image controller Rendering and I don't want to add the template interface to my page type, because I want to add the image dynamicaly to my site.
So here my "problems" ...
1
vote
1
answer
63
views
Base Controller in Habitat
We are using habitat in our project. In most of our controller class of each feature, we are doing a same service call.
So we are planning to have a Base Controller to avoid duplicates.
Since we ...
5
votes
1
answer
999
views
Sitecore 9 Platform Essentials Module 7 - Error Rendering Controller: Related Events when using an Edit Frame
I am working through the training for Sitecore 9 Platform Essentials. I am on Module 7 where they have you work on the Related Events controller and show you how to make a complex field editable in ...
3
votes
0
answers
48
views
How to make two controller renderings working on same page to preserve tracking?
I have AccountsController in my solution with two methods ExportData and DeleteAccount.
I have created two separate Controller Renderings with similar code:
@using System.Web.Mvc
@using System.Web....
0
votes
3
answers
2k
views
Passing an Item ID to the Controller via the Querystring
I am having an issue when passing itemid as query string to controller
url is rendered like this
http://sitecorelocal/api/sitecore/Product?sc_itemid=%7BB416980B-40A7-4C8F-8F98-375DD1CD9544%7
...
4
votes
1
answer
3k
views
@Html.Sitecore.Field is not rendering any values
In this code model, fields are returning value but when I try to render using @Html.Sitecore().Field its returning null.For experience editor, these fields should be editable.How to do it?
Am new to ...
2
votes
1
answer
423
views
What is purpose of the Controllers folder in Layouts?
I've noticed that in /sitecore/layout there is a Controllers folder (first item underneath actually). In that folder you can add items of type Controller. These items have fields for a controller name ...
1
vote
0
answers
132
views
Keep Sitecore Context Based On Page When Posting Back
I have a module that uses ajax to post back to the server for data. Some of this data is configurable while in experience editor. Users are winding up in a state with this module where experience ...
1
vote
0
answers
974
views
Why am I receiving the error :Could not find the rendering in the HTML loaded from server [closed]
Here is my controller:
namespace Website.Controllers
{
public class FormsController : Controller
{
// GET: Forms
public ActionResult Index()
{
return View()...
0
votes
1
answer
1k
views
Sitecore invoking Index() method from the Controller errantly [closed]
I have a component whose assigned controller does not have an Index method. This is intentional, as the controller action is set to a specific action method.
Regardless, Sitecore still attempts to ...
1
vote
2
answers
701
views
I need to integrate a controller from a compiled dll into a controller I can build/control. How can I call that as a rendering?
I'm able to call this compiled dll's controller directly in a Sitecore rendering - e.g. I can create a rendering where I reference the controller, controller action, and area and the content from the ...
6
votes
2
answers
718
views
IOC (Simple Injector) with EntityService
UPDATED WITH LATEST RESULTS AND QUESTION
I've converted everything to pipeline and integrated Simple Injector. As I mentioned, I've never used SI before, and I'm having trouble with the controller ...
1
vote
1
answer
146
views
Custom controller being overwritten by IoC
I have a simple Sitecore controller that returns an list of items from Sitecore. It's used it in a custom SPEAK UI page.
This works fine in my local dev environment but when I deploy it into an ...