Url.Content not working when using under .net core 3.1 &

Viewed 156

I am trying to follow below article for SAML implementation & i am very new to the .net core and SAML https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp

When added code into AuthController.cs , i am getting error for Login method. In below code Url.Content giving error 'The name url does not exist in current context'. Also package 'using Okta_SAML_Example.Identity;' is giving error regarding assembly as its not there.

var binding = new Saml2RedirectBinding(); binding.SetRelayStateQuery(new Dictionary<string, string> { { relayStateReturnUrl, returnUrl ?? Url.Content("~/") } });

Want to set the context : my idp will be internal organization idp [it will be configured by different team in org and for now they want me to provide attributes which i want in response] so where exactly in code it will be referred as i dont see IDP reference url in the code & xml sample too. please help me as need guidance at earlist.

1 Answers

I'm in doubt why you are seeing the error, it is not an error I have experienced. You can try to download the ITfoxtec.Identity SAML 2.0 code and run the TestIdPCore and TestWebAppCore samples in the test folder.

The library documentation.

The IdP can be configured in the appsettings.json file, here an example from the TestWebAppCore sample. The easiest way is to configure the IdP metadata, which will establish the trust without further configuration.

Related