dotnet/systemweb-adapters

Ask About HttpRequest.CurrentExecutionFilePath

Clounea opened this issue · 2 comments

Summary

Our repo uses HttpRequest.CurrentExecutionFilePath which is not supported by ASP.NetCore and this adapters.
I want to ask if there is equivalent and if there is plan to add them to adapter.

Motivation and goals

We need migrate code (an API in Sharepoint) to ASP.NetCore and we find that the APIs are not supported by ASP.NetCore.

In scope

  • HttpRequest.CurrentExecutionFilePath

From document, CurrentExecutionFilePath returns the file path to the currently executing page handler. For redirect scenarios using Execute and Transfer methods this means that the CurrentExecutionFilePath property returns the path to the page redirected to (child page). However, when the client is redirected to another page, the FilePath property returns the path to the original page.

But in HttpRequestInputStreamFeature.cs, the Rewrite function shows that the FilePath is changed to the new path. There is no variable recording the original path.

I wonder that will adapters support it?

Examples

bool isErrorPage = false;
if (context.Request.CurrentExecutionFilePath.EndsWith("Error.aspx"))
{
    isErrorPage = true;
}

So, if I understand correctly, it should be the same as FilePath, except under conditions that we don't currently support? It could probably be added to IHttpRequestPathFeature and surfaced that way. If Execute or Transfer is supported, they could then override it.

Feel free to enable it by updating:

internal interface IHttpRequestPathFeature
{
+   string CurrentExecutionFilePath { get; }
}