Page running as a dialog?

How can I find out whether my page was called via DialogService.OpenAsync() or directly via UriHelper.NavigateTo()?

There is no way to know that from the page itself. The only way in my opinion to track if there is navigation to some page is to use NavigationManager LocationChanged event.

My problem is that I call a login-protected dialog from a public page. After the logon dialog I am returned to the originating login-protected page, but this is presented not as a dialog, but as a normal page. Then of course the DialogService.Close() will not work to leave the page. So if I knew I was not running as a dialog I could use Navigate to get out...

You can probably add a boolean parameter IsDialog to that page and set it only when opening the page from a dialog.