简体   繁体   中英

system class(System.Web.UI.Page) property(httpresponse) equivalent in asp.net mvc5

I am reproducing a set of code from webform to mvc. I have a code in webform in which,

Webform(aspx.cs):

FederatedPassiveSecurityTokenServiceOperations.ProcessSignInResponse(responseMessage, Response);

where Response is a property of System.Web.Ui.Page class. I am not sure whether we can use it in MVC controller code since it is a page class.

What i have tried?

1.I tried creating an object of System.Web.Ui.Page class and passed object.Response. When i execute the code in controller it throws null.

2.I Created a property of httpResponse class (System.Web.HttpResponse) and passed it as argument in the above method. It throws null.

Is there any equivalent class property to System.Web.Ui.Page 's Response property that i can use for ProcessSignInResponse() of Microsoft.IdentityModel.FederatedPassiveSecurityTokenServiceOperations in MVC?

您可以使用静态属性System.Web.HttpContext.Current.Response

It dragged too much of time to find though it is an easy fix.

I used System.Web.HttpContext.Current.Response as the attribute in place of property Response(System.Web.Ui.Page).

C#(in Controller):

FederatedPassiveSecurityTokenServiceOperations.ProcessSignInResponse(responseMessage, System.Web.HttpContext.Current.Response );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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