Hi @Filipe Sousa,
how did you managed to add DelegatingHandler in umbraco 8.
I am struggling to migrate my code from v7 to v8 for custom delegatinghandler.
There is also a difference between trying to a User (an Umbraco CMS user) and a Member (like a user that is logged in to the frontend of the website).
The former will not be resolved with "contextReference.UmbracoContext.Security.CurrentUser", while the latter can be resolved like this.
Thanks! Mr.Tor for your answer I have another question related to data-Source files.
-> How we create data-Source file which is located form section.
I created one data-Source file in which they ask for the connection string and table name.
after saving that file we have one option to create a form from that file but after creating that I render macro at my content page but then it gives me the SQL error.
So, my main question is how can I create data-Source files and how to use that files in my content page. I need a reference.
Get current user
Hi there,
how do I get the current user within a DelegatingHandler when loading a page in the backoffice?
I'm injecting the IUmbracoContextFactory and fetching the user like so, but it's always null.
Much appreciated.
Hi Filipe,
On the frontend of the website the user would be null, in the Umbraco backoffice you would be able to get a proper user.
Cheers, Ruben
Hi @Filipe Sousa, how did you managed to add DelegatingHandler in umbraco 8. I am struggling to migrate my code from v7 to v8 for custom delegatinghandler.
Hi @Filipe Sousa,
There is also a difference between trying to a User (an Umbraco CMS user) and a Member (like a user that is logged in to the frontend of the website). The former will not be resolved with "contextReference.UmbracoContext.Security.CurrentUser", while the latter can be resolved like this.
Cheers, Ruben
Filipe, you can try the following to get the current user:
Hope it helps.
Hello, Enkosi
it's not working in Umbraco v11. any other solution are there?
Hi Shivani, here's one way of doing it:
Thanks! Mr.Tor for your answer I have another question related to data-Source files. -> How we create data-Source file which is located form section. I created one data-Source file in which they ask for the connection string and table name. after saving that file we have one option to create a form from that file but after creating that I render macro at my content page but then it gives me the SQL error.
So, my main question is how can I create data-Source files and how to use that files in my content page. I need a reference.
is working on a reply...