Website /Register route is throwing 404

Vote:
 

We set up a site from the Alloy template. Initially, https://siteurl/register was working. After we introduced languages, this route stopped working. I can see this message in the log file DEBUG EPiServer.Web.Routing.Segments.Internal.LanguageSegment: There was no language segment found for url 'register' and no language host mapping found therefore routing is stopped due to strict routing setting

I searched for the issue and tried everything suggested but I am still getting 404. Mainly followed this article https://world.episerver.com/blogs/Johan-Bjornfot/Dates1/2014/9/Changes-in-simple-address-routing/

It was for a much earlier version though. We are using version 11.20.5.0. What am I missing? Thanks for the help.

#249517
Mar 03, 2021 12:55
Vote:
 

I assume once you add another your new language URL works but the original URLs does not work? Once you have more than 1 language then your original URL should have a language identifier. 

#249518
Mar 03, 2021 13:49
Vote:
 

For example, your original Url is https://test.com/news

You have added a new language (let's say DE) - The new language url will be https://de.test.com/news or https://test.com/de/news (depends how you have setup in Manage websites/host settings)

Now your original url https://test.com/news gives you 404

The new "original" URL will be https://test.com/en/news 

if you specify default culture (let's say en) then your https://test.com/news will works as well

#249519
Mar 03, 2021 13:55
Vote:
 

Hi,

Thanks for responding. /Register is a custom route to create users in ASPNet Identity. It doesn't have a corresponding CMS page item in Episerver CMS. So, it is not the same as /news or en/news. I tried with en/register, that throws 404 too. The default language is set to en. All our CMS pages work without any problem.

#249520
Mar 03, 2021 14:05
Vote:
 

The out of the box register page created in Alloy is specifically for the creation of the first admin user. The register page itself has a check in the Business/AdministrationRegisterPage.cs class to if it's enabled such as if a user is register and if it's a local request. They might be blocking the page from loading so you'll have to adapt this logic if you need to use it

See the authorization check in the RegisterController class

        protected override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (!AdministratorRegistrationPage.IsEnabled)
            {
                filterContext.Result = new HttpNotFoundResult();
                return;
            }
            base.OnAuthorization(filterContext);
        }
#249521
Edited, Mar 03, 2021 14:45
Himadri - Mar 03, 2021 16:09
Thank you so much! That's the issue. That message in the log file got me so confused. I was thinking it is a routing issue.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.