M
M
Maxim Akhmerov2018-04-26 21:38:20
ASP.NET
Maxim Akhmerov, 2018-04-26 21:38:20

How to pass data between controllers and views?

in Asp net I did manual registration and authentication (checked against the database from ssms). so, I need to transfer data between views and controllers, namely an authenticated user, because I will order services on the site and the data should contain his id. I also want to display the email of the authenticated user in the layout,
tell me how can I implement this? Thank you

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem, 2018-04-26
@devspec

There are several methods .

E
eRKa, 2018-04-26
@kttotto

Learn in detail the concept of MVC and why it is needed. Data must flow from the controller to the view to be displayed, and from the view to the controller. No other way. None between views and between controllers.
If you want to store common data for all views, then store it either in the session (on the server side) or in cookies (on the client side). And index will read this data, for example from cookies, and display it in the layout.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question