/usr/share/asp.net-demos/1.1/asp.net/serial.aspx is in asp.net-examples 4.2-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <%@ Page language="C#" debug="true"%>
<%@ Register TagPrefix="mono" TagName="MonoSamplesHeader" src="~/controls/MonoSamplesHeader.ascx" %>
<%@ Import namespace="System.ComponentModel" %>
<%@ Import namespace="System.Globalization" %>
<!-- This test was used to fix bug #59495
Authors:
Gonzalo Paniagua Javier (gonzalo@ximian.com)
-->
<html>
<head>
<title>ViewState + TypeConverter</title>
<link rel="stylesheet" type="text/css" href="/mono-xsp.css">
<script runat="server">
public class MyStuffConverter : TypeConverter
{
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
// This is the second thing called. Type: string
HttpContext.Current.Response.Write ("<!-- CanConvertFrom called -->");
return true;
throw new Exception (sourceType.ToString ());
}
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
// This is called first. Type: System.String
// return false -> cannot be serialized
HttpContext.Current.Response.Write ("<!-- CanConvertTo called -->");
return true;
//throw new Exception (destinationType.ToString ());
}
public override object ConvertFrom (ITypeDescriptorContext context,
CultureInfo culture,
object value)
{
// This is called after clicking the button, even before CanConvertFrom
HttpContext.Current.Response.Write ("<!-- ConvertFrom called -->");
MyStuff ms = new MyStuff ();
ms.somevalue = Convert.ToInt32 (value);
return ms;
//throw new Exception (culture.Name);
}
public override object ConvertTo (ITypeDescriptorContext context,
CultureInfo culture,
object value,
Type destinationType)
{
HttpContext.Current.Response.Write ("<!-- ConvertTo called -->");
// Third. culture.Name is null or "" -> Invariant. Destination: string
MyStuff ms = (MyStuff) value;
return ms.somevalue.ToString (culture);
//throw new Exception ("\"" + culture.Name + "\""+ " " + destinationType.Name);
}
}
[TypeConverter (typeof (MyStuffConverter))]
public class MyStuff {
public int somevalue;
}
void Page_Load ()
{
if (IsPostBack) {
MyStuff old = (MyStuff) ViewState ["mystuff"];
lbl.Text = String.Format ("<br><b>Old value:<b> {0}<br>", old.somevalue);
old.somevalue++;
ViewState ["mystuff"] = old;
} else {
MyStuff ms = new MyStuff ();
ViewState ["mystuff"] = ms;
}
}
</script>
</head>
<body><mono:MonoSamplesHeader runat="server"/>
<form runat="server">
<asp:button type="submit" runat="server" Text="Click here" />
<asp:label id="lbl" runat="server" />
</form>
</body>
</html>
|