Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialdylan kane
2,772 PointsUser created Mongo DB document which is linked to their web request question
I have a mongo database set up on my website and I need to have something in my code link a value entered by the user in a form to a document. This is the easy part, which I have already figured out, but now I need this value to be linked to their viewing of the website only, sort of like account privileges on a social media site. I also need this value to be erased from the database once the user closes their tab with the website open, but this part of the question is not as important. An example of what I need is you go on a website, type your name into a form, and then once you press enter the value from the form is entered into a mongo document, and then linked to your computer only for a temporary account.
2 Answers
Steven Parker
231,261 PointsRather than store transitory user data in a database, this sounds like a something suited to the session data shared between the web server and client. Session data, by design, goes away when the user discontinues communication with the server. Session data is a common feature of web systems such as ASP.NET.
Session variables are often used to store user name, other ID information, and user preferences. Why put something into a database table or document unless you intend to keep it permanently?
dylan kane
2,772 PointsI simply did not know this was an option. could you provide me a link to learn more about asp.net for my specific use?