Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
3 answers
97 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 ...
John Lee's user avatar
1 vote
1 answer
133 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 ...
Matthew Pigram's user avatar
1 vote
0 answers
3k 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 ...
Erica Stockwell-Alpert's user avatar
0 votes
2 answers
257 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 ...
Newbie555's user avatar
0 votes
0 answers
118 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 ...
KRT's user avatar
  • 1
1 vote
1 answer
292 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 ...
Tai Vo's user avatar
  • 29
2 votes
2 answers
445 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, ...
Flo's user avatar
  • 45
1 vote
2 answers
577 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 ...
Olivia Shettles's user avatar
1 vote
1 answer
917 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 ...
Adam Seabridge's user avatar
3 votes
1 answer
359 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 ...
Mie ElMansy's user avatar
5 votes
2 answers
2k 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_", ...
sukesh's user avatar
  • 3,162
0 votes
0 answers
334 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 ...
sairfan's user avatar
  • 131
1 vote
1 answer
679 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 ...
Ken McAndrew's user avatar
  • 5,112
0 votes
1 answer
1k 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 ...
PVM's user avatar
  • 963
1 vote
1 answer
295 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() { ...
Jan Bluemink's user avatar
  • 1,185
2 votes
3 answers
752 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 ...
ACronin's user avatar
  • 21
1 vote
0 answers
251 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 ...
Teeknow's user avatar
  • 2,477
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 ...
Prakash's user avatar
  • 49
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....
squadwuschel's user avatar
  • 1,165
8 votes
1 answer
618 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" ...
squadwuschel's user avatar
  • 1,165
1 vote
1 answer
62 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 ...
PVM's user avatar
  • 963
5 votes
1 answer
934 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 ...
SoccerZortz's user avatar
3 votes
0 answers
45 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....
Peter Procházka's user avatar
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 ...
sitecore-u9's user avatar
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 ...
sitecore-u9's user avatar
2 votes
1 answer
405 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 ...
Gatogordo's user avatar
  • 20.1k
1 vote
0 answers
126 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 ...
Teeknow's user avatar
  • 2,477
1 vote
0 answers
942 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()...
Paul T. Rykiel's user avatar
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 ...
thiirteen's user avatar
1 vote
2 answers
690 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 ...
Amy Triplett's user avatar
6 votes
2 answers
703 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 ...
creativeflood's user avatar
1 vote
1 answer
143 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 ...
Adam Seabridge's user avatar