Guest User

Untitled

a guest
Feb 11th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. [ServiceBehavior( IncludeExceptionDetailInFaults = true )]
  2. public class TeyunaDataService : DataService< Meteora.TeyunaServices.Models.TeyunaContext >
  3. {
  4. public static void InitializeService(DataServiceConfiguration config)
  5. {
  6. config.SetEntitySetAccessRule("Clientes", EntitySetRights.AllRead );
  7. config.SetEntitySetAccessRule("Transacciones", EntitySetRights.All);
  8.  
  9. config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
  10. config.UseVerboseErrors = true;
  11. }
  12.  
  13. public TeyunaDataService()
  14. {
  15. this.ProcessingPipeline.ProcessingRequest += new EventHandler<DataServiceProcessingPipelineEventArgs>(OnRequest);
  16. }
  17.  
  18. void OnRequest(object sender, DataServiceProcessingPipelineEventArgs e)
  19. {
  20. var auth = HttpContext.Current.Request.Headers["Authorization"]; //This is empty
  21. }
  22. }
  23. }
  24.  
  25. OData.read({ requestUri: url, user: "pruebausr", password: "passprb" },
  26. function (data, request) {
  27. // ... code to procesing data (It works fine)
  28.  
  29. }, function(err) {
  30. $.mobile.hidePageLoadingMsg();
  31. alert("Error al obtener clientes. " + err.message);
  32. }
  33. );
Add Comment
Please, Sign In to add comment