1
I’m trying to get back to the previous page this way:
string urlAnterior = Request.Headers["Referer"].ToString();
if (urlAnterior.Contains("Pagina"))
return RedirectToAction("");
else
return RedirectToAction("");
However it returns me to the current updated page, I need to go back to the previous page, how to proceed?
Code I use to call create inside people:
<div class="form-group">
<a asp-page="/ContaReceber/Create" asp-route-id="@Request.Query[" id "]" class="btn btn-primary btn-sm">Criar nova Conta</a>
</div>
And this is where I call inside the Receivables Index:
<a asp-page="Create" class="btn btn-primary">Criar nova Conta</a>
It does not work for me, I use mvc page Razor. I tried to edit according to my need, but it does not return to the previous page.
– Mariana
I’ve put together some solutions that might work but I’d need more details to see what’s wrong.
– Amadeu Antunes
I tried some that would suit my scenario, but it didn’t work out, here’s the thing, I have the Edit page people, and the index page receivables, within the two I call to create receivables, I want that when it comes from within the Edit of people, it goes back to this page after including, and if it’s come from the index accounts receivable, after including I want it to go back to the index of accounts receivable.
– Mariana
if (Request.Urlreferrer == "url index") {Return view("view name") } Something like this ?
– Amadeu Antunes
I tried to do something like: if (idpessoa == 0) { Return Redirecttopage("./Index"); } Else { Return Redirecttopage("/Person/Edit?id=" + idpessoa); } but.
– Mariana