In that case, I've been searching around for an example where i have a HTML and AngularJS page within the app_plugins folder. It loads as expected and shows the HTML page as per the link.
If i wanted to carry out some codebehind operation such as getting some value from a database or read a config file (which i would use C# for) how would i go about achieving the same?
I initially got an error which was resolved by logging in.
I then got an error 'The requested resource does not support http method 'GET''
I surrounded it with [HttpGet]
Now i get HTTP/1.1 417 Missing token
To really narrow this down i decided to create a simple method as below
[HttpGet]
public string SayHello()
{
return "Hello World";
}
That too gives the same 417 error. I cleared my cache/history but the same error.
Yes i have seen that thread and nothing really worked on what was mentioned.
Here is the code in a new class library and what im doing. Ive read the threads so have upgraded to Umbraco 7.5 where i feel most bugs were ironed out (Essentially a fresh copy of this install).
using System.Web.Http;
using Umbraco.Web.Editors;
namespace Test
{
[Umbraco.Web.Mvc.PluginController("Notes")]
public class HelloController : UmbracoAuthorizedJsonController
{
[HttpGet]
public string SayHello()
{
return "Hello World";
}
}
}
At first i got authentication denied but after logging in that error went away and several attempts later i either see ERRCONNECTIONREFUSED in Chrome or in Fiddler i see
The connection to 'localhost' failed. Error: ConnectionRefused (0x274d). System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:80
Just working on that error but as soon as Fiddler is closed i see the above
Custom Section using cshtml?
I have created a custom section using this article as a guide
https://www.enkelmedia.se/blogg/2013/11/22/creating-custom-sections-in-umbraco-7-part-1/
Is it possible for me to use cshtml files instead of HTML/Angular? If so can anyone provide me with any guide?
Thanks
This isn't possible J. The back office is built on AngularJS and doesn't support cshtml.
@Brendan - Thank you
In that case, I've been searching around for an example where i have a HTML and AngularJS page within the app_plugins folder. It loads as expected and shows the HTML page as per the link.
If i wanted to carry out some codebehind operation such as getting some value from a database or read a config file (which i would use C# for) how would i go about achieving the same?
You will need to do either a post or get using is and call the method in your controller
Oh....any examples you could lead me to so i get an idea of what/where im doing all this? Thx
Here's a link to the docs that might be useful:
https://our.umbraco.com/Documentation/Tutorials/Creating-a-Property-Editor/part-4
Thanks, im working my way through and have hit a snag.
When i visit
localhost:1234/umbraco/backoffice/My/PersonApi/GetAll
I initially got an error which was resolved by logging in. I then got an error 'The requested resource does not support http method 'GET'' I surrounded it with [HttpGet]
Now i get HTTP/1.1 417 Missing token
To really narrow this down i decided to create a simple method as below
That too gives the same 417 error. I cleared my cache/history but the same error.
Am i missing something?
Here is a thread with a similar issue:
https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/60627-417-Missing-token-in-the-backoffice
Hi
Yes i have seen that thread and nothing really worked on what was mentioned.
Here is the code in a new class library and what im doing. Ive read the threads so have upgraded to Umbraco 7.5 where i feel most bugs were ironed out (Essentially a fresh copy of this install).
My URL is
http://localhost/umbraco/backoffice/notes/hello/sayhello
At first i got authentication denied but after logging in that error went away and several attempts later i either see ERRCONNECTIONREFUSED in Chrome or in Fiddler i see
The connection to 'localhost' failed.
Error: ConnectionRefused (0x274d).
System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:80
Just working on that error but as soon as Fiddler is closed i see the above
I will leave the above code as is but what got it working was changing
UmbracoAuthorizedJsonController
to
UmbracoAuthorizedApiController
Hopefully this is the correct way!!??
Glad you got it working
is working on a reply...