I´m using RO for .net is there any way to change the server info page without recompile the Rem objects solution?.. I´m trying to load projects on visual studio 2022 to change uROHtmlServerInfoRes.html but there is an uncompatible error message, which version or which complements do I need ?
Hi,
You can create a descendant of the HtmlServerInfo, override the GetServerInfo method and assign created descendant to serverchannel.HtmlServerInfo:
IpHttpServerChannel(server.NetworkServer.ServerChannel).HtmlServerInfo := new MyHtmlServerInfo();
MyHtmlServerInfo = public class(HtmlServerInfo)
private
protected
public
method GetServerInfo(rodlAssembly: System.Reflection.Assembly; dispatchers: RemObjects.SDK.Server.MessageDispatchers; extendedDispatchers: RemObjects.SDK.Server.ExtendedDispatcherList; addTrialNotification: Boolean; basePath: String): String; override;
begin
var htmlTemplate: String;
using resource := typeOf(MyHtmlServerInfo).Assembly.GetManifestResourceStream("ServerApp1.MyHtmlServerInfo.html") do begin
htmlTemplate := StreamHelpers.StreamToAnsiString(resource);
end;
exit GetServerInfo(rodlAssembly, dispatchers, extendedDispatchers, addTrialNotification, basePath, htmlTemplate);
end;
end;
I cannot implement your solution…
I’m using Remoting SDK for .NET version 10.0.0.1545, and I cannot descend from HtlmServerInfo it’s a static class on the other hand my IpHttpServerChannel doesn’t implement an HtmlServerInfo property
Hi,
We have added possibility to use custom info pages in .1555
ok, Great now it works…but I’m still having a problem… I want to overwrite the ServerErrorPage…by example, when someone hits an incorrect dispatcher
Hi,
you can do it with
IpHttpServerChannel(server.NetworkServer.ServerChannel).HttpRequest += OnHttpRequest;
...
class method OnHttpRequest(sender: Object;e: HttpRequestEventArgs);
begin
e.Response.HttpCode := System.Net.HttpStatusCode.OK;
e.Response.ContentString := '<body>ERROR</body>';
e.Handled := true;
end;
Note: this event is fired before processing documentation, fav icon, etc so if you need their support you should handle it by yourself, like
var cleanPath := HttpServerChannel.RemoveQueryParameters(e.Request.Path);
var dispatcherName := HttpServerChannel.GetDispatcherFromRequestPath(cleanPath).ToLowerInvariant();
e.Handled := not (HttpServerChannel.IsServerInfoPageRequested(this.ServeInfoPage, dispatcherName) or
HttpServerChannel.IsServerDocumentationPageRequested(this.ServeInfoPage, dispatcherName) or
HttpServerChannel.IsServerFavIconRequested(this.ServeInfoPage, dispatcherName) or
....
);
check implementation of ProcessExtendedRequest
method for more details
I’ve already implemented that solution, and it works, but I need to do the same with \bin path… seems for that path the error page raises before the HttpRequest event is fired when The IpHttpServer Channel.ServerRodl = false, when true shows WSDL info… I need to show my company custom page for all paths (no wsdl, no rodl, no error ).
Thanks in regards
Hi,
I can recommend to unregister all messages and process service requests manually in the HttpRequest
event
check example:
ServerApp1.zip (61.2 KB)
client.zip (66.6 KB)