public string HitHilite(int docRefId, string searchTerm, bool summaryResults, string versionNumber) { if (myatMng.AppMan.UseService) { return(myatMng.AppMan.AtriumX().HitHilite(docRefId, searchTerm, summaryResults, versionNumber, myatMng.AppMan.AtriumXCon)); } else { if (myatMng.AppMan.UsingRemote) { return(DALMngr.HitHilite(docRefId, searchTerm, summaryResults, versionNumber)); } else { try { if (myDalMngForHitHilite != null) { string x = myDalMngForHitHilite.User; } } catch (Exception x) { myDalMngForHitHilite = null; } if (myDalMngForHitHilite == null) { myDalMngForHitHilite = myatMng.AppMan.RemoteHelper(); } return(myDalMngForHitHilite.HitHilite(docRefId, searchTerm, summaryResults, versionNumber)); } } }
internal atriumDAL.DirectHelper RemoteHelper() { System.Runtime.Remoting.Channels.Http.HttpClientChannel hcc = null; try { hcc = RegisterChannel(hcc, myNC.UserName, myNC.Password, ServerInfo.remoteUrl); object obj = Activator.GetObject(typeof(atriumDAL.DirectHelper), ServerInfo.remoteUrl + "/RemoteActivationService.rem"); IDictionary dict = System.Runtime.Remoting.Channels.ChannelServices.GetChannelSinkProperties(obj); //set credentials on the proxy object dict["credentials"] = cc; if (System.Runtime.Remoting.RemotingConfiguration.GetRegisteredActivatedClientTypes().Length == 0) { System.Runtime.Remoting.RemotingConfiguration.RegisterActivatedClientType(typeof(atriumDAL.DirectHelper), ServerInfo.remoteUrl); //get instance of your object } atriumDAL.DirectHelper helper = new atriumDAL.DirectHelper(myNC.UserName, myNC.Password, ServerInfo.dbConnect); //object[] url ={ new System.Runtime.Remoting.Activation.UrlAttribute(remoteServer) }; //DALMngr = (atriumDAL.atriumDALManager)Activator.CreateInstance(typeof(atriumDAL.atriumDALManager), BindingFlags.ExactBinding , url,nc.UserName,nc.Password); //get channel sink object for your object and set credentials on that dict = System.Runtime.Remoting.Channels.ChannelServices.GetChannelSinkProperties(helper); dict["credentials"] = cc; return(helper); } catch (Exception xRemote) { ChannelServices.UnregisterChannel(hcc); throw; } }