These are the errors we get:
An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
The name 'Request' does not exist in the current context
+
string hyperlink = String.Format("https://{0}{1}", Request.Url.Host, Request.Url.AbsolutePath);
The name 'Request' does not exist in the current context
+
string hyperlink = String.Format("https://{0}{1}", Request.Url.Host, Request.Url.AbsolutePath);
The name 'Request' does not exist in the current context
+
ogImageUrl = String.Format("http://{0}{1}", Request.Url.Host, ogImage.Url);
The name 'Request' does not exist in the current context
+
ogImageUrl = String.Format("http://{0}/images/logo-fb.png", Request.Url.Host);
Is there a way to fix this or a better way to set it up?
The name 'Request' does not exist in the current context
We have in our old Umbraco (v8) a 'GetSocialMeta' partial. Obviously it won't work in our new Umbraco (v10) projects.
This is the code:
These are the errors we get: An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
Is there a way to fix this or a better way to set it up?
try Context.Request
although in .net core there is no Request.url.Host , it is just Request.Host
It unfortunately still returns the same errors
just noticed
That is not correct for Umbraco 9, IIRC it should be
You're right about that. But it isn't the solution
not sure why, works ok for me
Probably because i'm a pretty noob in back-end coding. I've no idea how to get this work in our code (above)
I'm not sure either as it just works for me. I just did a quick test and created a partialView as below
I then included it in my main page
@await Html.PartialAsync("Layout/_TestPartial")
and it works with no errorsThis works indeed. But how do i get it to work for:
&
Because if i adjust it the same way it still won't work
just replace Request.Url.Host with Context.Request.Host
I was too quick with my reply (deleted) Just replace them gives me other errors
I think it may need to be
ogImage.Url() not ogImage.Url
Ah f*ck, that's it. I still have to get used to that extra () compared to Umbraco 8.
Thanks for your help and above all patience.
Up to the next problem :P
Happy to help :) had to go through the same pain myself :D
is working on a reply...