dotnet/systemweb-adapters

Ask About HttpServerUtility.TransferRequest

Clounea opened this issue · 3 comments

Summary

Our repo uses HttpServerUtility.TransferRequest 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

HttpServerUtility.TransferRequest

From this post, it seems that there are several options.
Will adapters add this function?

Examples

context.Server.TransferRequest(
    modifiedUri,
    true,
    null,
    context.Request.Headers);

I took a look at how this works from an API, and looks like, everything gets funneled into HttpServerUtility.Execute(string path, TextWriter writer, bool preserveForm). It appears that there are a few ways that this may be made to work in core, but not really sure what the best way would be.

For now, adding something like the following:

public interface ITransferRequestFeature
{
  void Execute(string path, TextWriter writer, bool preserveForm)
}

and hooking it up to the HttpServerUtility can be enabled that allows the actually transferring to be handled in some way (i.e. maybe a redirect could be the default, but could be swapped out with whatever is required)

@twsouthwick feel free to assign to me...

[Triage]: Talked about this one in triage, and this might be difficult to achieve given it is really difficult to re-route requests in .NET Core. We could add the API and make it a no-op (Or throw PNSE) and marked as obsolete so the code compiles if that would be useful, but of course the idea would be to not call it at runtime.