当前位置: 首页>>代码示例>>C#>>正文


C# UI.LosFormatter类代码示例

本文整理汇总了C#中System.Web.UI.LosFormatter的典型用法代码示例。如果您正苦于以下问题:C# LosFormatter类的具体用法?C# LosFormatter怎么用?C# LosFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LosFormatter类属于System.Web.UI命名空间,在下文中一共展示了LosFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Ctor_BoolByteArray

		public void Ctor_BoolByteArray ()
		{
			LosFormatter lf1 = new LosFormatter (false, (byte []) null);
			string expected = NoKeyRoundTrip (lf1, "false, null");

			LosFormatter lf2 = new LosFormatter (true, (byte []) null);
			Assert.AreEqual (expected, NoKeyRoundTrip (lf2, "true, null"), "2");

			LosFormatter lf3 = new LosFormatter (false, Empty);
			Assert.AreEqual (expected, NoKeyRoundTrip (lf3, "false, empty"), "3");

			// an empty key is still a key - a signature is appended
			LosFormatter lf4 = new LosFormatter (true, Empty);
			string signed = NoKeyRoundTrip (lf4, "true, empty");
			Assert.AreNotEqual (expected, signed, "4");

			byte [] data = Convert.FromBase64String (expected);
			byte [] signed_data = Convert.FromBase64String (signed);
			Assert.IsTrue (BitConverter.ToString (signed_data).StartsWith (BitConverter.ToString (data)), "4 / same data");
#if NET_4_0
			// 32 bytes == 256 bits -> match HMACSHA256 as default
			Assert.AreEqual (32, signed_data.Length - data.Length, "signature length");
#else
			// 20 bytes == 160 bits -> match HMACSHA1 as default
			Assert.AreEqual (20, signed_data.Length - data.Length, "signature length");
#endif
		}
开发者ID:nobled,项目名称:mono,代码行数:27,代码来源:LosFormatterTest.cs

示例2: LoadPageStateFromCompressedViewState

 protected object LoadPageStateFromCompressedViewState()
 {
     string viewState = Request.Form["__VSTATE"];
     byte[] bytes = Convert.FromBase64String(viewState);
     bytes = IntegrationWebSiteMvc.Classes.Compressor.Decompress(bytes);
     LosFormatter formatter = new LosFormatter();
     return formatter.Deserialize(Convert.ToBase64String(bytes));
 }
开发者ID:bedford603067,项目名称:Augment,代码行数:8,代码来源:AssetAttributes.aspx.cs

示例3: Load

 public override void Load()
 {
     IPersistViewState state = Ra.Brix.Data.Internal.Adapter.Instance as IPersistViewState;
     LosFormatter formatter = new LosFormatter();
     Pair pair = formatter.Deserialize(state.Load(_session.ToString(), Page.Request.Url.ToString())) as Pair;
     ViewState = pair.First;
     ControlState = pair.Second;
 }
开发者ID:greaterwinner,项目名称:ra-brix,代码行数:8,代码来源:RaBrixPageStatePersister.cs

示例4: Load

 public override void Load()
 {
     string viewStateString = Page.Request["__AJAXVIEWSTATE"];
     viewStateString = viewStateString.Replace(",", "").Replace(" ", "");
     LosFormatter los = new LosFormatter();
     Pair pair = (Pair)los.Deserialize(viewStateString);
     base.ViewState = pair.First;
     base.ControlState = pair.Second;
 }
开发者ID:Houfeng,项目名称:AjaxEngine,代码行数:9,代码来源:HiddenFieldPageStatePersister.cs

示例5: LoadPageStateFromPersistenceMedium

        protected override object LoadPageStateFromPersistenceMedium()
        {
            string viewState = Request.Form["__VSTATE"];
            byte[] bytes = Convert.FromBase64String(viewState);
            LosFormatter formatter = new LosFormatter();

            bytes = bytes.Decompress();

            return formatter.Deserialize(Convert.ToBase64String(bytes));
        }
开发者ID:gabla5,项目名称:SO-Answers,代码行数:10,代码来源:CompressPageViewState.aspx.cs

示例6: SavePageStateToCompressedViewState

 protected void SavePageStateToCompressedViewState(object viewState)
 {
     LosFormatter formatter = new LosFormatter();
     System.IO.StringWriter writer = new System.IO.StringWriter();
     formatter.Serialize(writer, viewState);
     string viewStateString = writer.ToString();
     byte[] bytes = Convert.FromBase64String(viewStateString);
     bytes = IntegrationWebSiteMvc.Classes.Compressor.Compress(bytes);
     ClientScript.RegisterHiddenField("__VSTATE", Convert.ToBase64String(bytes));
 }
开发者ID:bedford603067,项目名称:Augment,代码行数:10,代码来源:AssetAttributes.aspx.cs

示例7: GetCacheKey

        /// <summary>
        /// Creates a unique key which describes the current object. This key is used
        /// by <see cref="SoundInTheory.DynamicImage.Caching.DynamicImageCacheManager" />
        /// to cache dynamically generated images.
        /// </summary>
        /// <returns>A unique key which describes the current object.</returns>
        public string GetCacheKey()
        {
            object allViewState = SaveViewState(true);

            LosFormatter formatter = new LosFormatter();
            StringWriter output = new StringWriter();
            formatter.Serialize(output, allViewState);

            return output.ToString();
        }
开发者ID:dbre2,项目名称:dynamic-image,代码行数:16,代码来源:StateManagedObject.cs

示例8: Deserialize_Stream_NonSeekable

		[Test] // bug #411115
		public void Deserialize_Stream_NonSeekable ()
		{
			string s1 = "Hello world";
			NonSeekableStream ns = new NonSeekableStream ();
			LosFormatter lf = new LosFormatter ();
			lf.Serialize (ns, s1);
			ns.Reset ();
			string s2 = lf.Deserialize (ns) as string;
			Assert.AreEqual (s1, s2);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:11,代码来源:LosFormatterTest.cs

示例9: LoadPageStateFromPersistenceMedium

        protected override object LoadPageStateFromPersistenceMedium()
        {
            string vState = this.Request.Form["__VSTATE"];
            byte[] bytes = System.Convert.FromBase64String( vState );

            bytes = this.Decompress( bytes );

            LosFormatter format = new LosFormatter();
            return format.Deserialize( System.Convert.ToBase64String( bytes ) );
        }
开发者ID:popovegor,项目名称:gt,代码行数:10,代码来源:GTCommonWebPage.cs

示例10: LosFormatter

		private LosFormatter  _formatter;// = new LosFormatter();
		protected override void SavePageStateToPersistenceMedium(object viewState)
		{
			_formatter = new LosFormatter();

			StringWriter sw = new StringWriter();
			_formatter.Serialize(sw, viewState);
			ComDePress cmp = new ComDePress();
			string outStr = cmp.Compress(sw.ToString());
			Page.RegisterHiddenField("__COMPRESSEDVIEWSTATE",outStr);
		}
开发者ID:alexan1,项目名称:marketweb,代码行数:11,代码来源:CompressedVSBasePage.cs

示例11: LoadPageStateFromPersistenceMedium

		protected override object LoadPageStateFromPersistenceMedium()
		{
			_formatter = new LosFormatter();
			object o;

			string vsString = Request.Form["__COMPRESSEDVIEWSTATE"];
			string outStr = new ComDePress().DeCompress(vsString);
			o = _formatter.Deserialize(outStr);
			return o;
		}
开发者ID:alexan1,项目名称:marketweb,代码行数:10,代码来源:CompressedVSBasePage.cs

示例12: Save

 public override void Save()
 {
     IPersistViewState state = Ra.Brix.Data.Internal.Adapter.Instance as IPersistViewState;
     LosFormatter formatter = new LosFormatter();
     StringBuilder builder = new StringBuilder();
     using (StringWriter writer = new StringWriter(builder))
     {
         formatter.Serialize(writer, new Pair(ViewState, ControlState));
     }
     state.Save(_session.ToString(), Page.Request.Url.ToString(), builder.ToString());
 }
开发者ID:greaterwinner,项目名称:ra-brix,代码行数:11,代码来源:RaBrixPageStatePersister.cs

示例13: Serialize

		[Test] // bug #324526
		public void Serialize ()
		{
			string s = "Hello world";
			LosFormatter lf = new LosFormatter ();
			StringWriter sw = new StringWriter ();
			lf.Serialize (sw, s);
			string s1 = sw.ToString ();
			Assert.IsNotNull (s1, "#1");
			string s2 = lf.Deserialize (s1) as string;
			Assert.IsNotNull (s2, "#2");
			Assert.AreEqual (s, s2, "#3");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:13,代码来源:LosFormatterTest.cs

示例14: Load

		public override void Load()
		{
			string id = _session.ToString() + "|" + Page.Request.Url.ToString();
            LosFormatter formatter = new LosFormatter();

			if (Page.Session[id] == null)
				throw new ArgumentException("session timeout ...");

			string obj = Page.Session[id] as string;
            Pair pair = formatter.Deserialize(obj) as Pair;
            ViewState = pair.First;
            ControlState = pair.Second;
		}
开发者ID:polterguy,项目名称:magix,代码行数:13,代码来源:Magix_PageStatePersister.cs

示例15: LoadPageStateFromPersistenceMedium

		/// <summary>
		/// Loads any saved view-state information to the <see cref="T:System.Web.UI.Page"></see> object.
		/// </summary>
		/// <returns>The saved view state.</returns>
		protected override object LoadPageStateFromPersistenceMedium()
		{
			String viewState =  Request.Params[ViewStateKey];

			if (viewState == null)
			{
				return null;
			}
			else
			{
				LosFormatter formatter = new LosFormatter();
				return formatter.Deserialize(viewState);
			}
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:18,代码来源:MasterPageBase.cs


注:本文中的System.Web.UI.LosFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。