Cristian T Cristian T - 1 year ago 72
C# Question

Redirect all the not found routes in dotvvm

How can I redirect all not found page requests to the same view?

This illustrates somehow what I mean:

config.RouteTable.Add("Home", "*", "Views/Home.dothtml", new { });

The idea behind is that when someone accesses a not existing page:


The resquest is redirected to


Answer Source

The only way I found so far is to implement it outside the dotvvm rules:

appBuilder.Run(context =>
    return Task.FromResult(0);

This means that basically any request not matching any route in the configured middlewares will be redirected to '/Home'. Not exactly the answer I was looking for, but it is effective.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download