Last post Feb 26, 2010 06:50 PM by bladesinger
Feb 26, 2010 09:52 AM|Scout7|LINK
Hi all, I have been asked an interesting question that I am unsure as to the answer to. I need to create a html helper that will generate buttons for me but will also then enable or disable them based upon a users access restrictions to specific functionality.
The dictionary of functionality that a user is restricted access to is currently held within the session state. Now this question is more about best practice than anything else, is an acceptabl;e/good/bad idea to access session data from within an Html helper?
Is it better to pass the session data to the html helper? Are there better ways of doing this?
Feb 26, 2010 06:50 PM|bladesinger|LINK
It is best to pass the data as parameter to the html helper. If you access the session directly from the helper you'll tie it to the Session which will also make the helper harder to test.