Get original url without non-standard port (C#)

前端 未结 6 883
执念已碎
执念已碎 2021-02-12 21:43

First question!


Environment

MVC, C#, AppHarbor.

Problem

I am calling an openid provider,

6条回答
  •  粉色の甜心
    2021-02-12 21:49

    I see that this is an old thread. I had this issue running MVC5, on IIS 7.5, with an Apache proxy in front. Outside of the server, I would get "Empty Response", since the asp.net app gets the Url from apache with the custom port.

    In order to have the app redirect to a subpath without including the "custom" port, forget the Response/Request objects, and use the Transfer method. For instance, if I want that users are automatically redirected to the login page in case they are not logged already:

    if (!User.Identity.IsAuthenticated)   
        Server.TransferRequest("Account/Login");
    

提交回复
热议问题