deal when re-usable data between in-process and real server implementation

I have an implementation that can be accessed either as an apache module or http.sys windows service either as in-process server. The code is nearly the same.
I need to provide in each request a couple of variables that usual they do not change. I put them inside the JWT as they are not critical and I get their value from TXDataOperationContext.Current.Request.User.Claims. With this implementation, I do not keep something in the server across requests, nor have to deal with thread access.
I do not have a similar solution with the in-process server.
I though that I could have a function that will return these values based on the type of the server but do you have something to propose?
My intention is to keep the code for the service implemention simple and the same between in-process & real type servers

I didn't understand if you mean that you can't have a similar solution with the in-process server, or if you don't want to have a similar solution with the in-process server?
You can't tell from the modules what the dispatcher is. Bu you can simply try to inspect the URL of the request, you will have an idea of what the URL of each of those dispatcher is, specially the in-process server which has a local:// scheme in the URL.

In a real server (like http.sys) the code that runs in a service implementation request needs to access a variable in TXDataOperationContext.Current.Request.User.claims to get a variable-data
Can I run the same code in an in-process server? How can I set the variable-data in the TXDataOperationContext.Current.Request.User.claims when calling an in-process server?

Also, except the URL, is there an other way to find faster if the dispatcher is an in-process server?

Yes, you could run the same code in an in-process server, why you couldn't? Have you tried it? Have you faced any issue? The process is the same, usually the Request.User.Claims is set by a JWT middleware. The middleware is in the server module, not the dispatcher, so the behavior is the same.

What is the problem in using the URL to check for the in-process server?

To be honest, I did not expected it. It works perfectly.
I apologize

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.