My problem is that, I have a strongly typed view and to retain some model values. I am using hidden control in my View. But due to security purpose, I don't want hidden fields on my View.If I will not use them then on Post action I am not getting the value
of model property in my controller.
I understand you do not like 1. Obviously, you do not like 2 . What do you say about 3?
( and I think that, with a proper level of roles on your system, 1 or 2 will not be a problem. Look at Active Directory - the fact you know a user name or SID does not allow you to delete the user if you are not admin or having proper rights)
You can try either Session objects or creating cookies (setting the value in them and placing in the response, then you can read them when you get next request).
Is there any other way? Client doesn't want any of the option - cookies, session, querystring, hidden fields.
In my application session is already very heavy....No more session
Please suggest something else. I have tried using [HiddenInput(DisplayValue= false)] attribute in my model property but still I can see the hidden control value in the source code of html. Any idea?
Client doesn't want any of the option - cookies, session, querystring, hidden fields.
1. Tell the client that's the way the Internet works.
or
2. Tell the client to login to yahoo, clear the cookies, close the browser, re-open mail.yahoo.com( no querystrings, please). Bet on any amount that he is not logged on yahoo.
dee_singh
Member
10 Points
10 Posts
How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 11:26 AM|LINK
Hi,
My problem is that, I have a strongly typed view and to retain some model values. I am using hidden control in my View. But due to security purpose, I don't want hidden fields on my View.If I will not use them then on Post action I am not getting the value of model property in my controller.
Please help!
Regards,
Deepti
"ASP.NET MVC" "asp.net Mvc" View Composition
qwe123kids
All-Star
48619 Points
7957 Posts
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 11:41 AM|LINK
Hi,
Have Tried using Sesison
Session["Test"] = Model.Name;
and Then Retrving on Action
Avinash Tiwari
Remember to click “Mark as Answer” on the post, if it helps you.
ignatandrei
All-Star
137649 Points
22143 Posts
Moderator
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 11:43 AM|LINK
On internet you can store information on:
1. fields( hidden or not)
2. query string
3. cookie
I understand you do not like 1. Obviously, you do not like 2 . What do you say about 3?
( and I think that, with a proper level of roles on your system, 1 or 2 will not be a problem. Look at Active Directory - the fact you know a user name or SID does not allow you to delete the user if you are not admin or having proper rights)
sachingusain
Star
8786 Points
1702 Posts
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 11:44 AM|LINK
You can try either Session objects or creating cookies (setting the value in them and placing in the response, then you can read them when you get next request).
Thanks.
ignatandrei
All-Star
137649 Points
22143 Posts
Moderator
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 11:55 AM|LINK
session for each action of a controller? It will make a nightmare...
qwe123kids
All-Star
48619 Points
7957 Posts
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 12:06 PM|LINK
Hi,
@ignat
But It Totally depends What he want To share..
Example..
While Updateing Record He May require Only "Name To be Updated" Know He May Keep "ID" In Session Receive Data Based On id
in Action Method and And Modify the Name Send The Informtion for Update.
Avinash Tiwari
Remember to click “Mark as Answer” on the post, if it helps you.
dee_singh
Member
10 Points
10 Posts
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 12:07 PM|LINK
Is there any other way? Client doesn't want any of the option - cookies, session, querystring, hidden fields.
In my application session is already very heavy....No more session
Please suggest something else. I have tried using [HiddenInput(DisplayValue= false)] attribute in my model property but still I can see the hidden control value in the source code of html. Any idea?
"ASP.NET MVC 2" "asp.net Mvc" View Composition
qwe123kids
All-Star
48619 Points
7957 Posts
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 12:12 PM|LINK
Have u tried Using profile
http://johnnycoder.com/blog/2010/04/01/asp-net-mvc-custom-profile-provider/
Avinash Tiwari
Remember to click “Mark as Answer” on the post, if it helps you.
ignatandrei
All-Star
137649 Points
22143 Posts
Moderator
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 12:16 PM|LINK
1. Tell the client that's the way the Internet works.
or
2. Tell the client to login to yahoo, clear the cookies, close the browser, re-open mail.yahoo.com( no querystrings, please). Bet on any amount that he is not logged on yahoo.
ignatandrei
All-Star
137649 Points
22143 Posts
Moderator
MVP
Re: How to get rid of hidden fields in ASP.net MVC 2
Nov 24, 2010 12:18 PM|LINK
And if he opens 2 browsers with same action, but with different ID ??