1

I created a Razor Class library (v6). In the RCL I have a page at ~/Pages/Page1.cshtml, which is accessible at /Page1.

But the RCL is for use in other projects, so I want a client project to be able to customise the path.

For example, how can a client project change that to /Foo/Page1?

1 Answer 1

0

This is a working but NON-IDEAL solution.

In the client project:

services.AddMyRclProject("/Foo/Page1");

In the RCL project:

public static void AddMyRclProject(this IServiceCollection services, string customRoute){

  services.AddRazorPages(x => {
    x.Conventions.AddPageRoute("/Page1", customRoute);
  });

}

This works, but both routes are active:

/Page1
/Foo/Page1

It's unclear how to remove the original one.

I'm leaving this question open. If you have a better way, add your answer and I'll accept it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.