简体   繁体   English

如何通过WebAPI重定向到经过身份验证的ASPX页面

[英]How to redirect to authenticated aspx page through webapi

One of our application is put under authentication which is used by other team. 我们的应用程序之一已通过其他团队使用的身份验证。

Now they want us to expose this aspx page to them through webapi so that they can use it as before without any authentication. 现在他们希望我们通过webapi向他们公开此aspx页面,以便他们可以像以前一样使用它而无需任何身份验证。

I have searched everywhere on internet and found 我在互联网上到处搜索,发现

 HttpResponseMessage res = Request.CreateResponse(HttpStatusCode.Redirect); 

that can be used. 可以使用。

But with that I am not able to find way to send authenticated request and also css files used in html not returned. 但与此同时,我无法找到发送经过身份验证的请求的方法,并且无法返回未使用html中的css文件。

Webapi is not meant to serve Html and css. Webapi并非旨在提供HTML和CSS。 It's intended to provide data in json, xml or whatever format required. 它旨在以json,xml或所需的任何格式提供数据。 Since html is a subset of xml it can be used to serve html. 由于html是xml的子集,因此可以用来提供html。

But in your case not the way to go. 但是,就您而言,这是不可行的。

If they want access to certain pages without authentication they should provide those pages with anonymous access. 如果他们要访问某些页面而不进行身份验证,则应为这些页面提供匿名访问。

Ie solve it with access attributes on the ViewControllers and/or areas. 即使用ViewController和/或区域上的访问属性来解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM