Reputation: 7121
I have the main page: http://localhost:5111?id=12234567
(this is a cshtml
page)
there are two links: one of them send to another controller: src= controller2/index?id=1234567
and the seconds send to: controller3/index
in the index
of controller2
I have another two links: one of them send to another controller: src= controller4/index?name=abcd
, and the second send to: controller5/preview
.
it doesn't matter which page I am found, the url is: http://localhost:5111?id=12234567
so when I refresh any page, I am redirected to the main page.
I want that when I refresh a page, I will stay in the same page (will the data be saved?)
any help appreviated!
Upvotes: 0
Views: 3669
Reputation: 5676
how can I stay in the same page when I reload it?
Your question is irritating. There is nothing like "same page" after "refreshing". Sad but true. Either you refresh a page, which includes a whole new HTTP-GET
of a brand new exemplar of the page -in case it was not cached; or you stay so to say on the same old one -what a waste- the server delivered.
What you could do is: to develop a page, whose content is updated dynamically, which means, after you retrieved "fresh" content and added that to the DOM, you stay "on the same page", meaning, your browser shows the same URL as before. But to give concrete hints, a little bit more information would be nice.
EDIT:
Okay! The additional Information is a little bit helpful, but not quite enlightning.
As far as I can get it, you have some routing problems. To "stay on the same page" your controller has to redirect the user after a POST
to the same URL. If you want to display the entered data, you have to use a model which contains the data entered to render the values to the page.
Upvotes: 1