Exemplo n.º 1
0
        public virtual string GetRightSideUrl(HttpRequest leftSideRequest)
        {
            string path = leftSideRequest.Path.Substring(_httpAppicationRootLength);

            if (!path.StartsWith("/"))
            {
                path = "/" + path;
            }

            string rightSideUrl = _applicationDirectory.GetFullTargetPath(path + leftSideRequest.Url.Query);

            if (rightSideUrl.EndsWith("//"))
            {
                rightSideUrl = rightSideUrl.Substring(0, rightSideUrl.Length - 1);
            }

            var urlSessionId = leftSideRequest.Headers["AspFilterSessionId"];

            if (urlSessionId != null && urlSessionId.StartsWith("S(") && urlSessionId.EndsWith(")"))
            {
                var insertIndex = _applicationDirectory.RootUrl.Length - 1;
                rightSideUrl = rightSideUrl.Insert(insertIndex, "/(" + urlSessionId + ")");
            }

            TraceScope.Current.TraceData(TraceEventType.Verbose, (int)Event.CalculateRightSideUrl,
                                         String.Format("LeftSideUrl={0} RigthSideUrl={1}", path, rightSideUrl));

            return(rightSideUrl);
        }
Exemplo n.º 2
0
        public void RightSideUrl()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(PathMap));
            PathMap       mapping    = (PathMap)serializer.Deserialize(
                new System.IO.StreamReader(
                    @"MappingTest\Mapping.xml"));

            Directory dir1 = mapping.GetDirectory("/zmrsoap");

            Assert.IsNotNull(dir1, "dir1 not found.");
            Assert.AreEqual("zmrsoap", dir1.Name);
            Assert.AreEqual(
                "https://portals-test.bmi.gv.at/bmi.gv.at/soapv2/soaphttpengine/soapv2%23pvp1?dest=ZMR&opzone=test",
                dir1.GetFullTargetPath("/zmrsoap/"));

            ApplicationDirectory appStatistik = mapping.GetApplication("/statistik.at/vis.test.extern/");

            Assert.IsNotNull(appStatistik, "appStatistik not found.");
            Assert.AreEqual("vis.test.extern", appStatistik.Name);
            Assert.AreEqual("https://awp.statistik.at/statistik.at/vis.test.extern/", appStatistik.RootUrl);
            Assert.AreEqual("https://awp.statistik.at/statistik.at/vis.test.extern/einFile.txt",
                            appStatistik.GetFullTargetPath("/statistik.at/vis.test.extern/einFile.txt"));

            ApplicationDirectory withPort = mapping.GetApplication("/withport/");

            Assert.IsNotNull(withPort, "withport not found.");
            Assert.AreEqual("https://egora:8443/test", withPort.FullTargetPath);
            Assert.AreEqual("https://egora:8443/test/hello.htm", withPort.GetFullTargetPath("/withport/hello.htm"));

            ApplicationDirectory defaultApp = mapping.GetApplication("/someunknownurl/");

            Assert.IsNotNull(defaultApp, "defaultApp not found.");
            Assert.AreEqual(string.Empty, defaultApp.Name);
        }