Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question