Send Authorization cookie when calling OData service

前端 未结 1 1171
既然无缘
既然无缘 2021-01-25 13:31

I have 2 web applications.
The first web application contains ASP.NET web pages and used a Membership provider for authentication.
The second web application is strictly

相关标签:
1条回答
  • 2021-01-25 14:12

    Here is what I did to solve the problem.

    dbContext.BuildingRequest += AddCookie;
    private void AddCookie(object sender, Microsoft.OData.Client.BuildingRequestEventArgs e)
    {       
        var authCookie = HttpContext.Current.Request.Cookies(".TESTAUTH");
    
        e.Headers.Add("Cookie", ".TESTAUTH=" + authCookie.Value);
    }
    
    0 讨论(0)
提交回复
热议问题