/// <summary> /// if the DocData is less then 2083 characters long (that is internet explorer's address bar limit), inline the actual /// data to the URL. When that can't be achieved the document will be stored in MemoryCache and a quazi-ticket-number /// will URL parameter will be used guaranteeing availability of anything that requests it within 10 minutes of this /// method being called. /// </summary> /// <param name="BaseDoc"></param> /// <param name="RelayUrl"></param> /// <returns></returns> public static string ToUrl(BaseDoc BaseDoc, string RelayUrl = null) { if (string.IsNullOrWhiteSpace(RelayUrl)) { RelayUrl = ReverseProxy.GetRelayUrl(); } string DocTypeName = BaseDoc.DocTypeName; string _Url = string.IsNullOrWhiteSpace(RelayUrl) ? string.Format("{0}/DocDataHandler.ashx?DocTypeName={1}&{2}={3}", RequestPaths.ApplicationPath, DocTypeName, Parm.DocBin, HttpUtility.UrlEncode(Compressor.CompressToBase64String(BaseDoc.ToBytes()))) : string.Format("{0}/DocDataHandler.ashx?DocTypeName={1}&{2}={3}&{4}={5}", RelayUrl, DocTypeName, Parm.DocBin, HttpUtility.UrlEncode(Compressor.CompressToBase64String(BaseDoc.ToBytes())), Parm.RelayUrl, HttpUtility.UrlEncode(RelayUrl) ); //REF:http://support.microsoft.com/kb/208427 if (_Url.Length > 2083) { string _CacheKey = HttpUtility.UrlEncode(string.Format("{0}.{1}", DocTypeName, _Url.GetHashCode())); if (HttpRuntime.Cache[_CacheKey] == null) { HttpRuntime.Cache.Insert(_CacheKey, BaseDoc, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } _Url = string.IsNullOrWhiteSpace(RelayUrl) ? string.Format("{0}/DocDataHandler.ashx?DocTypeName={1}&{2}={3}", RequestPaths.ApplicationPath, DocTypeName, Parm.DocCache, _CacheKey) : string.Format("{0}/DocDataHandler.ashx?DocTypeName={1}&{2}={3}&{4}={5}", RelayUrl, DocTypeName, Parm.DocCache, _CacheKey, Parm.RelayUrl, HttpUtility.UrlEncode(RelayUrl)); } return(_Url); }
public static string ToUrl(string DocTypeName, string DocId, string RelayUrl = "~", long LogSequenceNumber = 0) { if (string.IsNullOrWhiteSpace(RelayUrl)) { RelayUrl = ReverseProxy.GetRelayUrl(); } return(string.IsNullOrWhiteSpace(RelayUrl) ? string.Format("{0}/DocDataHandler.ashx?&DocTypeName={1}&{2}={3}&LogSequenceNumber={4}", RelayUrl, DocTypeName, Parm.DocId, DocId, LogSequenceNumber) : string.Format("{0}/DocDataHandler.ashx?{6}={4}&DocTypeName={1}&{2}={3}&LogSequenceNumber={5}", RelayUrl, DocTypeName, Parm.DocId, DocId, HttpUtility.UrlEncode(RelayUrl), LogSequenceNumber, Parm.RelayUrl)); }