Advertisement
Guest User

Wcf.svc

a guest
Aug 11th, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //WCF CODE
  2. namespace SRS_WCF
  3. {
  4.     [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
  5.     public class SRSService : ISRSService
  6.     {
  7.         public SRSService()
  8.         {
  9.             /* this line is crucial for PrincipalPermission to work */
  10.             Thread.CurrentPrincipal = HttpContext.Current.User;
  11.         }
  12.        
  13.         [PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
  14.         public string Test() //Throws Error
  15.         {
  16.             return "Hello";
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement