Have you tried reading the documentation? While that may be somehow hidden and there are not many howtos on the internet for that stuff, it is quite well documented. Code Access Security is what you are looking for.
A good start is:
http://msdn.microsoft.com/en-us/library/dd233103(v=vs.110).aspx
which is titled "Security Changes in the .NET Framework" (and no, I wont start quoting here). YOu look for things like "Code Access Security" to create a sanbox style environment. This is possible, but like all security it is seriously non trivial because if you overlook a single thing, then the sandbox is open. Expect to spend serious time in that stuff - or have an illusion of security with hugh open holes you simply are not aware of.