Search code examples
c#asp.nethttp-redirectdotvvm

DotVVM Redirection


Hi I would like to ask what is the correct way for redirection from a command in dotVVM framework. I am trying to redirect to another page via Context.Redirect() function that actually works but I get an exception "DotVVM.Framework.Hosting.DotvvmInterruptRequestExecutionException" with additional information "Error in the application" that actually doesn't help and I would like to get rid of it, not just ignoring it. My current code is

DotHTML

<dot:Button Click="{command: Register()}" Text="Register" class="register-button" />

cs

public void Register()
{
    Context.Redirect("Register");
}

Solution

  • The exception is OK. DotVVM uses exceptions internally to perform the redirects - there is no other reasonable way to do that. Just hit F5 in Visual Studio and it will continue.