+2009-09-07 Marek Habersack <mhabersack@novell.com>
+
+ * Makefile (TEST_RESOURCE_FILES): added
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap
+
2009-08-26 Marek Habersack <mhabersack@novell.com>
* Makefile (TEST_RESOURCE_FILES): added
Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx \
Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config \
Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.1.1 \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap \
+ Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap \
Test/mainsoft/NunitWebResources/menuclass.aspx \
Test/mainsoft/NunitWebResources/FormView.aspx \
Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx \
+2009-09-07 Marek Habersack <mhabersack@novell.com>
+
+ * HostingEnvironment.cs: MapPath checks if HttpContext.Request
+ actually exists before using it.
+
2009-08-26 Marek Habersack <mhabersack@novell.com>
* IApplicationHost.cs: added
throw new ArgumentNullException ("virtualPath");
HttpContext context = HttpContext.Current;
- if (context == null)
+ HttpRequest req = context == null ? null : context.Request;
+ if (req == null)
return null;
- return context.Request.MapPath (virtualPath);
+ return req.MapPath (virtualPath);
}
public static void RegisterObject (IRegisteredObject obj)
+2009-09-07 Marek Habersack <mhabersack@novell.com>
+
+ * XmlSiteMapProvider.cs: do not allow the provider to be
+ intialized more than once.
+ Initialize throws if it finds unknown attributes in the
+ 'attributes' collection.
+ AddNode checks its arguments and throws if they are null or aren't
+ from the same provider.
+ FindStartingNode throws exceptions in several erroneous situations
+ now.
+ Added private method GetConfigDocument which performs several
+ checks on the source .sitemap file and throws exceptions if it
+ finds any errors.
+ BuildSiteMap clears provider state before building the map.
+ BuildSiteMapRecursive correctly deals with custom providers. Fixes
+ bug #465696
+ FindSiteMapNode maps url before searching. Fixes bug #465696
+
+ * VirtualPathUtility.cs: Combine a bit more efficient
+
+ * StaticSiteMapProvider.cs: FindSiteMap node checks if rawUrl is
+ relative to application root and if yes, makes it absolute.
+ MapUrl converts both rooted and not rooted urls to absolute.
+
+ * SiteMapProvider.cs: check if HttpContext.Request exists before
+ using it in FindSiteMapnode
+
+ * SiteMap.cs: Providers collection must be read-only.
+
2009-09-04 Marek Habersack <mhabersack@novell.com>
* HttpRuntime.cs: retrieve real Mono version from the runtime and
throw new InvalidOperationException ("This feature is currently disabled. Please enable it in the system.web/siteMap section in the web.config file.");
providers = section.ProvidersInternal;
+ providers.SetReadOnly ();
provider = providers[section.DefaultProvider];
if (provider == null)
{
if (context == null)
return null;
+
+ HttpRequest req = context.Request;
+ if (req == null)
+ return null;
- SiteMapNode ret = this.FindSiteMapNode (context.Request.RawUrl);
+ SiteMapNode ret = this.FindSiteMapNode (req.RawUrl);
if (ret == null)
- ret = this.FindSiteMapNode (context.Request.Path);
+ ret = this.FindSiteMapNode (req.Path);
return ret;
}
#if NET_2_0
using System.Collections.Generic;
+using System.Web.Util;
namespace System.Web
{
"StaticSiteMapProvider requires that sitemap nodes have unique URLs.",
node.Url
));
-
+
urlToNode.Add (url, node);
}
keyToNode.Add (node.Key, node);
BuildSiteMap();
SiteMapNode node;
- urlToNode.TryGetValue (MapUrl (rawUrl), out node);
+ if (VirtualPathUtility.IsAppRelative (rawUrl))
+ rawUrl = VirtualPathUtility.ToAbsolute (rawUrl, HttpRuntime.AppDomainAppVirtualPath, false);
+
+ if (!urlToNode.TryGetValue (rawUrl, out node))
+ return null;
+
return CheckAccessibility (node);
}
return (node != null && IsAccessibleToUser (HttpContext.Current, node)) ? node : null;
}
- string MapUrl (string url)
+ internal string MapUrl (string url)
{
+ if (String.IsNullOrEmpty (url))
+ return url;
+
+ string appVPath = HttpRuntime.AppDomainAppVirtualPath;
+
if (VirtualPathUtility.IsAppRelative (url))
- return VirtualPathUtility.ToAbsolute (url);
+ return VirtualPathUtility.ToAbsolute (url, appVPath, false);
else
- return url;
+ return VirtualPathUtility.ToAbsolute (UrlUtils.Combine (appVPath, url), appVPath, false);
}
}
}
if (IsRooted (relativePath))
return Normalize (relativePath);
- if (basePath [basePath.Length - 1] != '/') {
- if (basePath.Length > 1) {
+ int basePathLen = basePath.Length;
+ if (basePath [basePathLen - 1] != '/') {
+ if (basePathLen > 1) {
int lastSlash = basePath.LastIndexOf ('/');
if (lastSlash >= 0)
basePath = basePath.Substring (0, lastSlash + 1);
- }
- else { // "~" only
+ } else { // "~" only
basePath += "/";
}
}
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
// Lluis Sanchez Gual (lluis@novell.com)
+// Marek Habersack <mhabersack@novell.com>
//
// (C) 2003 Ben Maurer
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2009 Novell, Inc (http://www.novell.com)
//
//
using System.Globalization;
using System.Text;
using System.Xml;
+using System.Web.Hosting;
using System.Web.Util;
using System.IO;
static readonly char [] seperators = { ';', ',' };
static readonly StringComparison stringComparison = HttpRuntime.RunningOnWindows ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
- bool building;
- string file;
+ bool initialized;
string fileVirtualPath;
SiteMapNode root = null;
List <FileSystemWatcher> watchers;
protected internal override void AddNode (SiteMapNode node, SiteMapNode parentNode)
{
- base.AddNode (node, parentNode);
+ if (node == null)
+ throw new ArgumentNullException ("node");
+
+ if (parentNode == null)
+ throw new ArgumentNullException ("parentNode");
+
+ SiteMapProvider nodeProvider = node.Provider;
+ if (nodeProvider != this)
+ throw new ArgumentException ("SiteMapNode '" + node + "' cannot be found in current provider, only nodes in the same provider can be added.",
+ "node");
+
+ SiteMapProvider parentNodeProvider = parentNode.Provider;
+ if (nodeProvider != parentNodeProvider)
+ throw new ArgumentException ("SiteMapNode '" + parentNode + "' cannot be found in current provider, only nodes in the same provider can be added.",
+ "parentNode");
+
+ AddNodeNoCheck (node, parentNode);
}
+ void AddNodeNoCheck (SiteMapNode node, SiteMapNode parentNode)
+ {
+ base.AddNode (node, parentNode);
+ SiteMapProvider nodeProvider = node.Provider;
+ if (nodeProvider != this)
+ RegisterChildProvider (nodeProvider.Name, nodeProvider);
+ }
+
protected virtual void AddProvider (string providerName, SiteMapNode parentNode)
{
if (parentNode == null)
ChildProviders.Add (smp);
}
- XmlNode FindStartingNode (string file, string virtualPath, out bool enableLocalization)
+ XmlNode FindStartingNode (string virtualPath, out bool enableLocalization)
{
- if (String.Compare (Path.GetExtension (file), ".sitemap", stringComparison) != 0)
- throw new InvalidOperationException (
- String.Format ("The file {0} has an invalid extension, only .sitemap files are allowed in XmlSiteMapProvider.",
- String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
- if (!File.Exists (file))
- throw new InvalidOperationException (
- String.Format ("The file '{0}' required by XmlSiteMapProvider does not exist.",
- String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
-
- XmlDocument d = new XmlDocument ();
- d.Load (file);
+ XmlDocument d = GetConfigDocument (virtualPath);
+ XmlElement docElement = d.DocumentElement;
- XmlNode enloc = d.DocumentElement.Attributes ["enableLocalization"];
+ if (String.Compare ("siteMap", docElement.Name, StringComparison.Ordinal) != 0)
+ throw new ConfigurationErrorsException ("Top element must be 'siteMap'");
+
+ XmlNode enloc = docElement.Attributes ["enableLocalization"];
if (enloc != null && !String.IsNullOrEmpty (enloc.Value))
enableLocalization = (bool) Convert.ChangeType (enloc.Value, typeof (bool));
else
enableLocalization = false;
-
- XmlNode nod = d.DocumentElement ["siteMapNode"];
- if (nod == null)
- throw new HttpException ("Invalid site map file: " + Path.GetFileName (file));
- return nod;
+ XmlNodeList childNodes = docElement.ChildNodes;
+ XmlNode node = null;
+
+ foreach (XmlNode child in childNodes) {
+ if (String.Compare ("siteMapNode", child.Name, StringComparison.Ordinal) != 0)
+ // Only <siteMapNode> is allowed at the top
+ throw new ConfigurationErrorsException ("Only <siteMapNode> elements are allowed at the document top level.");
+
+ if (node != null)
+ // Only one <siteMapNode> is allowed at the top
+ throw new ConfigurationErrorsException ("Only one <siteMapNode> element is allowed at the document top level.");
+
+ node = child;
+ }
+
+ if (node == null)
+ throw new ConfigurationErrorsException ("Missing <siteMapNode> element at the document top level.");
+
+ return node;
}
-
+
+ XmlDocument GetConfigDocument (string virtualPath)
+ {
+ if (String.IsNullOrEmpty (virtualPath))
+ throw new ArgumentException ("The siteMapFile attribute must be specified on the XmlSiteMapProvider");
+
+ string file = HostingEnvironment.MapPath (virtualPath);
+ if (file == null)
+ throw new HttpException ("Virtual path '" + virtualPath + "' cannot be mapped to physical path.");
+
+ if (String.Compare (Path.GetExtension (file), ".sitemap", stringComparison) != 0)
+ throw new InvalidOperationException (String.Format ("The file {0} has an invalid extension, only .sitemap files are allowed in XmlSiteMapProvider.",
+ String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
+
+ if (!File.Exists (file))
+ throw new InvalidOperationException (String.Format ("The file '{0}' required by XmlSiteMapProvider does not exist.",
+ String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
+
+ ResourceKey = Path.GetFileName (file);
+ CreateWatcher (file);
+
+ XmlDocument d = new XmlDocument ();
+ d.Load (file);
+
+ return d;
+ }
+
public override SiteMapNode BuildSiteMap ()
{
if (root != null)
return root;
+
// Whenever you call AddNode, it tries to find dups, and will call this method
// Is this a bug in MS??
- if (building)
- return null;
-
lock (this_lock) {
- try {
- building = true;
- if (root != null)
- return root;
-
- bool enableLocalization;
- XmlNode node = FindStartingNode (file, fileVirtualPath, out enableLocalization);
- EnableLocalization = enableLocalization;
- SiteMapNode builtRoot = BuildSiteMapRecursive (node, EnableLocalization);
-
- if (builtRoot != root) {
- root = builtRoot;
- AddNode (root);
- }
- } finally {
- building = false;
+ if (root != null)
+ return root;
+
+ Clear ();
+ bool enableLocalization;
+ XmlNode node = FindStartingNode (fileVirtualPath, out enableLocalization);
+ EnableLocalization = enableLocalization;
+ BuildSiteMapRecursive (node, null);
+
+ // if (builtRoot != root) {
+ // root = builtRoot;
+ // AddNode (root);
+ // }
+
+ return root;
+ }
+ }
+
+ SiteMapNode ConvertToSiteMapNode (XmlNode xmlNode)
+ {
+ bool localize = EnableLocalization;
+ string url = GetOptionalAttribute (xmlNode, "url");
+ string title = GetOptionalAttribute (xmlNode, "title");
+ string description = GetOptionalAttribute (xmlNode, "description");
+ string roles = GetOptionalAttribute (xmlNode, "roles");
+ string implicitResourceKey = GetOptionalAttribute (xmlNode, "resourceKey");
+
+ // var keywordsList = new List <string> ();
+ // if (keywords != null && keywords.Length > 0) {
+ // foreach (string s in keywords.Split (seperators)) {
+ // string ss = s.Trim ();
+ // if (ss.Length > 0)
+ // keywordsList.Add (ss);
+ // }
+ // }
+
+ var rolesList = new List <string> ();
+ if (roles != null && roles.Length > 0) {
+ foreach (string s in roles.Split (seperators)) {
+ string ss = s.Trim ();
+ if (ss.Length > 0)
+ rolesList.Add (ss);
}
+ }
+
+ url = base.MapUrl (url);
+
+ NameValueCollection attributes = null;
+ NameValueCollection explicitResourceKeys = null;
+ if (localize)
+ CollectLocalizationInfo (xmlNode, ref title, ref description, ref attributes, ref explicitResourceKeys);
+ else
+ foreach (XmlNode att in xmlNode.Attributes)
+ PutInCollection (att.Name, att.Value, ref attributes);
+
+ string key = Guid.NewGuid ().ToString ();
+ return new SiteMapNode (this, key, url, title, description, rolesList.AsReadOnly (),
+ attributes, explicitResourceKeys, implicitResourceKey);
+ }
+
+ void BuildSiteMapRecursive (XmlNode xmlNode, SiteMapNode parent)
+ {
+ if (xmlNode.Name != "siteMapNode")
+ throw new ConfigurationException ("incorrect element name", xmlNode);
+
+ string attrValue = GetNonEmptyOptionalAttribute (xmlNode, "provider");
+ if (attrValue != null) {
+ SiteMapProvider provider = SiteMap.Providers [attrValue];
+ if (provider == null)
+ throw new ProviderException ("Provider with name [" + attrValue + "] was not found.");
+
+ provider.ParentProvider = this;
+ SiteMapNode providerRoot = provider.GetRootNodeCore();
+
+ if (parent == null)
+ root = providerRoot;
+ else
+ AddNodeNoCheck (providerRoot, parent);
+ return;
+ }
+
+ attrValue = GetNonEmptyOptionalAttribute (xmlNode, "siteMapFile");
+ if (attrValue != null) {
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", attrValue);
+
+ string description = GetOptionalAttribute (xmlNode, "description");
+ if (!String.IsNullOrEmpty (description))
+ nvc.Add ("description", description);
+
+ string name = MapUrl (attrValue);
+ var provider = new XmlSiteMapProvider ();
+ provider.Initialize (name, nvc);
- return root;
+ SiteMapNode providerRoot = provider.GetRootNodeCore ();
+ if (parent == null)
+ root = providerRoot;
+ else
+ AddNodeNoCheck (providerRoot, parent);
+ return;
+ }
+
+ SiteMapNode curNode = ConvertToSiteMapNode (xmlNode);
+ if (parent == null)
+ root = curNode;
+ else
+ AddNodeNoCheck (curNode, parent);
+
+ XmlNodeList childNodes = xmlNode.ChildNodes;
+ if (childNodes == null || childNodes.Count < 1)
+ return;
+
+ foreach (XmlNode child in childNodes) {
+ if (child.NodeType != XmlNodeType.Element)
+ continue;
+
+ BuildSiteMapRecursive (child, curNode);
}
}
-
+
string GetNonEmptyOptionalAttribute (XmlNode n, string name)
{
return System.Web.Configuration.HandlersUtil.ExtractAttributeValue (name, n, true);
PutInCollection (att.Name, value, ref attributes);
}
}
-
- SiteMapNode BuildSiteMapRecursive (XmlNode xmlNode, bool localize)
- {
- if (xmlNode.Name != "siteMapNode")
- throw new ConfigurationException ("incorrect element name", xmlNode);
-
- string provider = GetNonEmptyOptionalAttribute (xmlNode, "provider");
- string siteMapFile = GetNonEmptyOptionalAttribute (xmlNode, "siteMapFile");
-
- if (provider != null) {
- SiteMapProvider smp = SiteMap.Providers [provider];
- if (smp == null)
- throw new ProviderException ("Provider with name [" + provider + "] was not found.");
-
- smp.ParentProvider = this;
- SiteMapNode root = smp.GetRootNodeCore();
- RegisterChildProvider (provider, smp);
-
- return root;
- } else if (siteMapFile != null) {
- if (file.Length == 0)
- throw new InvalidOperationException ("The 'siteMapFile' attribute cannot be an empty string.");
- string realPath = HttpContext.Current.Request.MapPath (siteMapFile);
- bool enableLocalization;
- XmlNode node = FindStartingNode (realPath, siteMapFile, out enableLocalization);
-
- CreateWatcher (realPath);
- return BuildSiteMapRecursive (node, enableLocalization);
- } else {
- string url = GetOptionalAttribute (xmlNode, "url");
- string title = GetOptionalAttribute (xmlNode, "title");
- string description = GetOptionalAttribute (xmlNode, "description");
- string keywords = GetOptionalAttribute (xmlNode, "keywords");
- string roles = GetOptionalAttribute (xmlNode, "roles");
- string implicitResourceKey = GetOptionalAttribute (xmlNode, "resourceKey");
-
- ArrayList keywordsList = new ArrayList ();
- if (keywords != null && keywords.Length > 0) {
- foreach (string s in keywords.Split (seperators)) {
- string ss = s.Trim ();
- if (ss.Length > 0)
- keywordsList.Add (ss);
- }
- }
-
- ArrayList rolesList = new ArrayList ();
- if (roles != null && roles.Length > 0) {
- foreach (string s in roles.Split (seperators)) {
- string ss = s.Trim ();
- if (ss.Length > 0)
- rolesList.Add (ss);
- }
- }
-
- if (!string.IsNullOrEmpty (url)) {
- if (UrlUtils.IsRelativeUrl (url))
- url = UrlUtils.Combine (HttpRuntime.AppDomainAppVirtualPath, url);
- }
-
- NameValueCollection attributes = null;
- NameValueCollection explicitResourceKeys = null;
- if (localize)
- CollectLocalizationInfo (xmlNode, ref title, ref description, ref attributes,
- ref explicitResourceKeys);
- else
- foreach (XmlNode att in xmlNode.Attributes)
- PutInCollection (att.Name, att.Value, ref attributes);
-
- string key = Guid.NewGuid ().ToString ();
- SiteMapNode node = new SiteMapNode (this, key, url, title, description,
- ArrayList.ReadOnly (rolesList),
- attributes,
- explicitResourceKeys,
- implicitResourceKey);
-
- foreach (XmlNode child in xmlNode.ChildNodes) {
- if (child.NodeType != XmlNodeType.Element)
- continue;
- AddNode (BuildSiteMapRecursive (child, EnableLocalization), node);
- }
-
- return node;
- }
- }
protected override void Clear ()
{
public override SiteMapNode FindSiteMapNode (string rawUrl)
{
- SiteMapNode node = base.FindSiteMapNode (rawUrl);
+ string url = base.MapUrl (rawUrl);
+ SiteMapNode node = base.FindSiteMapNode (url);
if (node != null)
return node;
foreach (SiteMapProvider smp in ChildProviders) {
- node = smp.FindSiteMapNode (rawUrl);
+ node = smp.FindSiteMapNode (url);
if (node != null)
return node;
}
public override void Initialize (string name, NameValueCollection attributes)
{
- base.Initialize (name, attributes);
- fileVirtualPath = attributes ["siteMapFile"];
- if (String.IsNullOrEmpty (fileVirtualPath))
- throw new ArgumentException ("The siteMapFile attribute must be specified on the XmlSiteMapProvider.");
-
- HttpContext ctx = HttpContext.Current;
- HttpRequest req = ctx != null ? ctx.Request : null;
-
- if (req != null)
- file = req.MapPath (fileVirtualPath, HttpRuntime.AppDomainAppVirtualPath, false);
- else
- throw new InvalidOperationException ("Request is missing - cannot map paths.");
-
- if (File.Exists (file)) {
- ResourceKey = Path.GetFileName (file);
- CreateWatcher (file);
+ if (initialized)
+ throw new InvalidOperationException ("XmlSiteMapProvider cannot be initialized twice.");
+
+ initialized = true;
+ if (attributes != null) {
+ foreach (string key in attributes.AllKeys) {
+ switch (key) {
+ case "siteMapFile":
+ fileVirtualPath = attributes ["siteMapFile"];
+ break;
+
+ case "description":
+ break;
+
+ default:
+ throw new ConfigurationErrorsException ("The attribute '" + key + "' is unexpected in the configuration of the '" + name + "' provider.");
+ }
+ }
}
+
+ base.Initialize (name, attributes != null ? attributes : new NameValueCollection ());
}
void CreateWatcher (string file)
mainsoft/NunitWeb/NunitWeb/WebTest.cs
mainsoft/NunitWeb/NunitWeb/WebTestResourcesSetupAttribute.cs
mainsoft/NunitWeb/NunitWeb/Tests/TagsNestedInClientTag.cs
+mainsoft/NunitWeb/NunitWeb/Tests/TestSiteMapProvider.cs
System.Web/AppBrowsersTest.cs
System.Web/HttpBrowserCapabilitiesTest.cs
System.Web/HttpCacheVaryByContentEncodingsTest.cs
System.Web.Util/TransactionsCas.cs
System.Web.Util/UrlUtilsTest.cs
System.Web.Util/WorkItemCas.cs
+System.Web/XmlSiteMapProviderTest.cs
+2009-09-07 Marek Habersack <mhabersack@novell.com>
+
+ * XmlSiteMapProviderTest.cs: added
+
+ * StaticSiteMapProviderTest.cs: added test for FindSiteMapNode
+
2009-07-13 Gert Driesen <drieseng@users.sourceforge.net>
* HttpResponseTest.cs: Store data from all calls to
using MonoTests.SystemWeb.Framework;
using System.Web.UI;
+using Tests;
+
namespace MonoTests.System.Web {
class StaticPoker : StaticSiteMapProvider
Assert.IsTrue (b, "#1");
}
+ [Test]
+ public void FindSiteMapNode_01 ()
+ {
+ new WebTest (PageInvoker.CreateOnLoad (FindSiteMapNode_01_OnLoad)).Run ();
+ }
+
+ public static void FindSiteMapNode_01_OnLoad (Page p)
+ {
+ var provider = new TestSiteMapProvider ();
+ Assert.IsNotNull (provider.RootNode, "#A1");
+ Assert.AreEqual ("default.aspx", provider.RootNode.Url, "#A1-1");
+
+ SiteMapNode node = provider.FindSiteMapNode ("default.aspx");
+ Assert.IsNull (node, "#A2");
+
+ node = provider.FindSiteMapNode ("/NunitWeb/default.aspx");
+ Assert.IsNotNull (node, "#A3");
+ Assert.AreEqual ("default.aspx", node.Url, "#A3-1");
+ Assert.AreEqual ("Test", node.Title, "#A3-2");
+
+ node = provider.FindSiteMapNode ("~/default.aspx");
+ Assert.IsNotNull (node, "#A4");
+ Assert.AreEqual ("default.aspx", node.Url, "#A4-1");
+ Assert.AreEqual ("Test", node.Title, "#A4-2");
+ }
+
[TestFixtureTearDown]
public void TearDown ()
{
--- /dev/null
+//
+// System.Web.SiteMapProviderTest.cs - Unit tests for System.Web.SiteMapProvider
+//
+// Author:
+// Marek Habersack <mhabersack@novell.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Configuration.Provider;
+using System.Diagnostics;
+using System.Reflection;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Web.Hosting;
+using NUnit.Framework;
+
+using MonoTests.stand_alone.WebHarness;
+using MonoTests.SystemWeb.Framework;
+
+using Tests;
+
+namespace MonoTests.System.Web
+{
+ [TestFixture]
+ public class XmlSiteMapProviderTest
+ {
+
+ [TestFixtureSetUp]
+ public void SetUp ()
+ {
+ Type myType = GetType ();
+#if VISUAL_STUDIO
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_01.sitemap", "test_map_01.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_02.sitemap", "test_map_02.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_03.sitemap", "test_map_03.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_04.sitemap", "test_map_04.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_05.sitemap", "test_map_05.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_06.sitemap", "test_map_06.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_07.sitemap", "test_map_07.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_08.sitemap", "test_map_08.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_09.sitemap", "test_map_09.sitemap");
+ WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.sub_map_01.sitemap", "sub_map_01.sitemap");
+#else
+ WebTest.CopyResource (myType, "test_map_01.sitemap", "test_map_01.sitemap");
+ WebTest.CopyResource (myType, "test_map_02.sitemap", "test_map_02.sitemap");
+ WebTest.CopyResource (myType, "test_map_03.sitemap", "test_map_03.sitemap");
+ WebTest.CopyResource (myType, "test_map_04.sitemap", "test_map_04.sitemap");
+ WebTest.CopyResource (myType, "test_map_05.sitemap", "test_map_05.sitemap");
+ WebTest.CopyResource (myType, "test_map_06.sitemap", "test_map_06.sitemap");
+ WebTest.CopyResource (myType, "test_map_07.sitemap", "test_map_07.sitemap");
+ WebTest.CopyResource (myType, "test_map_08.sitemap", "test_map_08.sitemap");
+ WebTest.CopyResource (myType, "test_map_09.sitemap", "test_map_09.sitemap");
+ WebTest.CopyResource (myType, "sub_map_01.sitemap", "sub_map_01.sitemap");
+#endif
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddNode_Null_1 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var node = new SiteMapNode (provider, "/test.aspx");
+
+ provider.DoAddNode (null, node);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddNode_Null_2 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var node = new SiteMapNode (provider, "/test.aspx");
+
+ provider.DoAddNode (node, null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddNode_DifferentProviders_01 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var node = new SiteMapNode (new TestSiteMapProvider (), "/test.aspx");
+ var parentNode = new SiteMapNode (provider, "/test2.aspx");
+
+ // SiteMapNode cannot be found in current provider, only nodes in the same provider can be added.
+ provider.DoAddNode (node, parentNode);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddNode_DifferentProviders_02 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var node = new SiteMapNode (provider, "/test.aspx");
+ var parentNode = new SiteMapNode (new TestSiteMapProvider (), "/test2.aspx");
+
+ // SiteMapNode cannot be found in current provider, only nodes in the same provider can be added.
+ provider.DoAddNode (node, parentNode);
+ }
+
+ [Test]
+ [ExpectedException (typeof (HttpException))]
+ public void AddNode_01 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var node = new SiteMapNode (provider, "/test.aspx");
+ var parentNode = new SiteMapNode (provider, "/test2.aspx");
+
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
+ provider.Initialize ("TestMap", nvc);
+
+ // The application relative virtual path '~/test_map_01.sitemap' cannot be made absolute, because the path to the application is not known.
+ provider.DoAddNode (node, parentNode);
+ }
+
+ [Test]
+ public void AddNode_02 ()
+ {
+ new WebTest (PageInvoker.CreateOnLoad (AddNode_02_OnLoad)).Run ();
+ }
+
+ public static void AddNode_02_OnLoad (Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ provider.CallTrace = null;
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
+ provider.Initialize ("TestMap", nvc);
+
+ SiteMapNode rootNode = provider.RootNode;
+ provider.CallTrace = null;
+
+ var node = new SiteMapNode (provider, "test3.aspx", "~/test3.aspx");
+ provider.DoAddNode (node, rootNode);
+
+ Assert.IsNotNull (provider.CallTrace, "#A1");
+ Assert.Greater (provider.CallTrace.Length, 1, "#A1-1");
+ Assert.AreEqual (provider.CallTrace[0].Name, "BuildSiteMap", "#A1-2");
+ }
+
+ [Test]
+ public void Initialize_1 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+
+ provider.Initialize ("TestMap", null);
+ Assert.AreEqual ("TestMap", provider.Name, "#A1");
+ }
+
+ [Test]
+ public void Initialize_2 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+
+ provider.Initialize ("TestMap", new NameValueCollection ());
+ Assert.AreEqual ("TestMap", provider.Name, "#A1");
+ }
+
+ [Test]
+ public void Initialize_3 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "test.sitemap");
+ provider.Initialize ("TestMap", nvc);
+ Assert.AreEqual ("TestMap", provider.Name, "#A1");
+ }
+
+ [Test]
+ public void Initialize_4 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "test.sitemap");
+ nvc.Add ("description", "Test XML provider");
+ provider.Initialize ("TestMap", nvc);
+ Assert.AreEqual ("TestMap", provider.Name, "#A1");
+ Assert.AreEqual ("Test XML provider", provider.Description, "#A2");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ConfigurationErrorsException))]
+ public void Initialize_5 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "test.sitemap");
+ nvc.Add ("description", "Test XML provider");
+
+ // The attribute 'acme' is unexpected in the configuration of the 'TestMap' provider.
+ nvc.Add ("acme", "test provider");
+ provider.Initialize ("TestMap", nvc);
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void Initialize_6 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+
+ provider.Initialize ("TestMap", null);
+
+ // XmlSiteMapProvider cannot be initialized twice
+ provider.Initialize ("TestMap2", null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void RootNode_1 ()
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+
+ // Thrown from internal GetConfigDocument ():
+ // The siteMapFile attribute must be specified on the XmlSiteMapProvider
+ provider.Initialize ("TestMap", null);
+ var rn = provider.RootNode;
+ }
+
+ [Test]
+ public void RootNode_2 ()
+ {
+ new WebTest (PageInvoker.CreateOnLoad (RootNode_2_OnLoad)).Run ();
+ }
+
+ public static void RootNode_2_OnLoad (Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ provider.CallTrace = null;
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
+ provider.CallTrace = null;
+ provider.Initialize ("TestMap", nvc);
+ Assert.IsNotNull (provider.RootNode, "#A1");
+ Assert.AreEqual (provider.RootNode.Provider, provider, "#A2");
+ Assert.IsNotNull (provider.CallTrace, "#A3");
+ Assert.Greater (provider.CallTrace.Length, 1, "#A3-1");
+ Assert.AreEqual (provider.CallTrace[0].Name, "BuildSiteMap", "#A3-2");
+ Assert.AreEqual (provider.CallTrace[1].Name, "get_RootNode", "#A3-3");
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void InvalidFileExtension ()
+ {
+ // The file /NunitWeb/test_map_01.extension has an invalid extension, only .sitemap files are allowed in XmlSiteMapProvider.
+ new WebTest (PageInvoker.CreateOnLoad (InvalidFileExtension_OnLoad)).Run ();
+ }
+
+ public static void InvalidFileExtension_OnLoad (Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/test_map_01.extension");
+
+ provider.Initialize ("TestMap", nvc);
+ var rn = provider.RootNode;
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void MissingMapFile ()
+ {
+ new WebTest (PageInvoker.CreateOnLoad (MissingMapFile_OnLoad)).Run ();
+ }
+
+ public static void MissingMapFile_OnLoad (Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/missing_map_file.sitemap");
+
+ provider.Initialize ("TestMap", nvc);
+ var rn = provider.RootNode;
+ }
+
+ [Test]
+ public void NodeWithSiteMapFile_01 ()
+ {
+ var test = new WebTest (PageInvoker.CreateOnLoad (NodeWithSiteMapFile_01_OnLoad)).Run ();
+ }
+
+ public static void NodeWithSiteMapFile_01_OnLoad (Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/test_map_02.sitemap");
+
+ provider.Initialize ("TestMap", nvc);
+ var rn = provider.RootNode;
+
+ string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Sub 1 [/NunitWeb/sub_map_01.sitemap][1]; Sub Sub 1 [/NunitWeb/sub_map_01.sitemap][2]";
+ string treeString = provider.GetTreeString ();
+
+ Assert.AreEqual (expectedTreeString, treeString, "#A1");
+ }
+
+ [Test]
+ public void NodeWithProvider_01 ()
+ {
+ var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+ NodeWithProvider_OnLoad ("~/test_map_07.sitemap", p);
+ })).Run ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (ProviderException))]
+ public void NodeWithProvider_02 ()
+ {
+ new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+ NodeWithProvider_OnLoad ("~/test_map_08.sitemap", p);
+ })).Run ();
+ }
+
+ public static void NodeWithProvider_OnLoad (string filePath, Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", filePath);
+
+ provider.Initialize ("TestMap", nvc);
+ var rn = provider.RootNode;
+
+ string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Test [TestSiteMapProvider][1]";
+ string treeString = provider.GetTreeString ();
+ Assert.AreEqual (expectedTreeString, treeString, "#A1");
+
+ SiteMapNode node = provider.FindSiteMapNode ("default.aspx");
+ Assert.IsNotNull (node, "#B1");
+ Assert.AreEqual ("Test", node.Title, "#B1-1");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ConfigurationErrorsException))]
+ public void InvalidMapFile_01 ()
+ {
+ // Top element must be siteMap.
+ new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+ InvalidMapFile_OnLoad ("~/test_map_03.sitemap", p);
+ })).Run ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (ConfigurationErrorsException))]
+ public void InvalidMapFile_02 ()
+ {
+ // Only <siteMapNode> elements are allowed at this location.
+ var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+ InvalidMapFile_OnLoad ("~/test_map_04.sitemap", p);
+ })).Run ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (ConfigurationErrorsException))]
+ public void InvalidMapFile_03 ()
+ {
+ // Only <siteMapNode> elements are allowed at this location.
+ var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+ InvalidMapFile_OnLoad ("~/test_map_05.sitemap", p);
+ })).Run ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (ConfigurationErrorsException))]
+ public void InvalidMapFile_04 ()
+ {
+ // Only <siteMapNode> elements are allowed at this location.
+ var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+ InvalidMapFile_OnLoad ("~/test_map_06.sitemap", p);
+ })).Run ();
+ }
+
+ public static void InvalidMapFile_OnLoad (string filePath, Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", filePath);
+
+ provider.Initialize ("TestMap", nvc);
+ var rn = provider.RootNode;
+ }
+
+ [Test]
+ public void MapFileWithNonStandardAttributes ()
+ {
+ // Only <siteMapNode> elements are allowed at this location.
+ new WebTest (PageInvoker.CreateOnLoad (MapFileWithNonStandardAttributes_OnLoad)).Run ();
+ }
+
+ public static void MapFileWithNonStandardAttributes_OnLoad (Page p)
+ {
+ var provider = new XmlSiteMapProviderPoker ();
+ var nvc = new NameValueCollection ();
+ nvc.Add ("siteMapFile", "~/test_map_09.sitemap");
+
+ provider.Initialize ("TestMap", nvc);
+ var rn = provider.RootNode;
+
+ //TODO: find out what happens to non-standard attributes
+ //SiteMapNode node = rn.ChildNodes[0];
+ //Assert.IsNotNull (node, "#A1");
+ //Assert.AreEqual ("some, keyword, another, one", node["keywords"], "#A1-1");
+
+ //node = rn.ChildNodes[1];
+ //Assert.IsNotNull (node, "#B1");
+ //Assert.AreEqual("value", node["someattribute"], "#B1-1");
+ }
+ }
+
+ class XmlSiteMapProviderPoker : XmlSiteMapProvider
+ {
+ public MethodBase[] CallTrace { get; set; }
+
+ public void DoAddNode (SiteMapNode node, SiteMapNode parentNode)
+ {
+ AddNode (node, parentNode);
+ }
+
+ public override SiteMapNode BuildSiteMap ()
+ {
+ StoreCallTrace ();
+ return base.BuildSiteMap ();
+ }
+
+ public string GetTreeString ()
+ {
+ var sb = new StringBuilder ();
+ int untitled_counter = 0;
+ BuildTreeString (RootNode, sb, 0, ref untitled_counter);
+ return sb.ToString ();
+ }
+
+ void BuildTreeString (SiteMapNode top, StringBuilder sb, int level, ref int untitled_counter)
+ {
+ string title = top.Title;
+
+ if (String.IsNullOrEmpty (title))
+ title = "UNTITLED_" + untitled_counter++;
+
+ SiteMapProvider provider = top.Provider;
+ if (provider != this) {
+ if (provider == null)
+ title += " [NULL_PROVIDER]";
+ else {
+ string name = provider.Name;
+ if (String.IsNullOrEmpty (name))
+ title += " [" + provider.GetType () + "]";
+ else
+ title += " [" + name + "]";
+ }
+ }
+
+ if (sb.Length > 0)
+ sb.Append ("; ");
+ sb.Append (title + "[" + level + "]");
+ SiteMapNodeCollection childNodes = top.ChildNodes;
+ if (childNodes != null && childNodes.Count > 0) {
+ foreach (SiteMapNode child in childNodes)
+ BuildTreeString (child, sb, level + 1, ref untitled_counter);
+ }
+ }
+
+ void StoreCallTrace ()
+ {
+ CallTrace = null;
+ StackFrame[] frames = new StackTrace (1).GetFrames ();
+ var frameMethods = new List<MethodBase> ();
+
+ int i = 0;
+ foreach (StackFrame sf in frames)
+ frameMethods.Add (sf.GetMethod ());
+ CallTrace = frameMethods.ToArray ();
+ }
+ }
+}
+#endif
\ No newline at end of file
+2009-09-07 Marek Habersack <mhabersack@novell.com>
+
+ * Tests/TestSiteMapProvider.cs: added
+
2009-07-08 Marek Habersack <mhabersack@novell.com>
* WebTest.cs: added new public property - TestBaseDir, to be used
-using System;\r
-\r
-namespace MainsoftWebApp\r
-{\r
- public partial class Global : System.Web.HttpApplication\r
- {\r
-#if NET_2_0\r
- protected void Application_Error (object sender, EventArgs e)\r
- {\r
- // Code that runs when an unhandled error occurs\r
- Exception objErr = Server.GetLastError ().GetBaseException ();\r
- MonoTests.SystemWeb.Framework.WebTest.RegisterException (objErr);\r
- Server.ClearError ();\r
- }\r
-\r
- protected void Application_OnEndRequest (object sender, EventArgs e) {\r
- // Ensure the headers are sent\r
- MonoTests.SystemWeb.Framework.WebTest.CurrentTest.SendHeaders ();\r
- }\r
-#endif\r
- }\r
-}\r
+using System;
+
+namespace MainsoftWebApp
+{
+ public partial class Global : System.Web.HttpApplication
+ {
+#if NET_2_0
+ protected void Application_Error (object sender, EventArgs e)
+ {
+ // Code that runs when an unhandled error occurs
+ Exception objErr = Server.GetLastError ().GetBaseException ();
+ MonoTests.SystemWeb.Framework.WebTest.RegisterException (objErr);
+ Server.ClearError ();
+ }
+
+ protected void Application_OnEndRequest (object sender, EventArgs e) {
+ // Ensure the headers are sent
+ MonoTests.SystemWeb.Framework.WebTest.CurrentTest.SendHeaders ();
+ }
+#endif
+ }
+}
-<%@ WebHandler Class="MonoTests.SystemWeb.Framework.MyHandler" Language="C#" %>\r
+<%@ WebHandler Class="MonoTests.SystemWeb.Framework.MyHandler" Language="C#" %>
-<%@ Master Language="C#" %>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >\r
-<head id="Head1" runat="server">\r
- <title></title>\r
-</head>\r
- <body>\r
- <asp:contentplaceholder id="Header" runat="server">\r
- Master header text\r
- </asp:contentplaceholder>\r
- \r
- <asp:contentplaceholder id="Main" runat="server">\r
- Master main text \r
- </asp:contentplaceholder>\r
- \r
- <asp:contentplaceholder id="Dynamic" runat="server">\r
- Master dynamic text\r
- </asp:contentplaceholder>\r
- \r
- <asp:contentplaceholder id="Footer" runat="server">\r
- My master page footer \r
- </asp:contentplaceholder>\r
- \r
- Master page content text\r
- \r
- </body>\r
-</html>\r
+<%@ Master Language="C#" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
+<head id="Head1" runat="server">
+ <title></title>
+</head>
+ <body>
+ <asp:contentplaceholder id="Header" runat="server">
+ Master header text
+ </asp:contentplaceholder>
+
+ <asp:contentplaceholder id="Main" runat="server">
+ Master main text
+ </asp:contentplaceholder>
+
+ <asp:contentplaceholder id="Dynamic" runat="server">
+ Master dynamic text
+ </asp:contentplaceholder>
+
+ <asp:contentplaceholder id="Footer" runat="server">
+ My master page footer
+ </asp:contentplaceholder>
+
+ Master page content text
+
+ </body>
+</html>
-<%@ Master Language="C#" MasterPageFile="My.master"%> \r
-<%@ MasterType VirtualPath="My.master" %>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >\r
-<head id="Head1" runat="server">\r
- <title></title>\r
-</head>\r
- <body>\r
- <asp:contentplaceholder id="Header" runat="server">\r
- Master header text\r
- </asp:contentplaceholder>\r
- \r
- <asp:contentplaceholder id="Main" runat="server">\r
- Master main text \r
- </asp:contentplaceholder>\r
- \r
- <asp:contentplaceholder id="Dynamic" runat="server">\r
- Master dynamic text\r
- </asp:contentplaceholder>\r
- \r
- <asp:contentplaceholder id="Footer" runat="server">\r
- My master page footer \r
- </asp:contentplaceholder>\r
- \r
- Master page content text\r
- \r
- </body>\r
-</html>\r
+<%@ Master Language="C#" MasterPageFile="My.master"%>
+<%@ MasterType VirtualPath="My.master" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
+<head id="Head1" runat="server">
+ <title></title>
+</head>
+ <body>
+ <asp:contentplaceholder id="Header" runat="server">
+ Master header text
+ </asp:contentplaceholder>
+
+ <asp:contentplaceholder id="Main" runat="server">
+ Master main text
+ </asp:contentplaceholder>
+
+ <asp:contentplaceholder id="Dynamic" runat="server">
+ Master dynamic text
+ </asp:contentplaceholder>
+
+ <asp:contentplaceholder id="Footer" runat="server">
+ My master page footer
+ </asp:contentplaceholder>
+
+ Master page content text
+
+ </body>
+</html>
-<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" >\r
-<head id="Head1" runat="server">\r
- <title>Untitled Page</title>\r
-</head>\r
-<body>\r
- <form id="form1" runat="server">\r
- <div>\r
- \r
- </div>\r
- </form>\r
-</body>\r
-</html>\r
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head id="Head1" runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+
+ </div>
+ </form>
+</body>
+</html>
-#if TARGET_JVM\r
-#define BUG_78521_FIXED\r
-#endif\r
-\r
-using System;\r
-using System.Web.UI;\r
-using MonoTests.SystemWeb.Framework;\r
-\r
-public partial class MyPage : System.Web.UI.Page\r
-{\r
- //FIXME: mono defines its own constructor here\r
-#if BUG_78521_FIXED\r
- public MyPage ()\r
-#else\r
- protected override void OnPreInit (EventArgs e)\r
-#endif\r
- {\r
- WebTest t = WebTest.CurrentTest;\r
- if (t != null)\r
- t.Invoke (this);\r
- }\r
- \r
- public override void VerifyRenderingInServerForm (Control c)\r
- {\r
-\r
- }\r
-}\r
+#if TARGET_JVM
+#define BUG_78521_FIXED
+#endif
+
+using System;
+using System.Web.UI;
+using MonoTests.SystemWeb.Framework;
+
+public partial class MyPage : System.Web.UI.Page
+{
+ //FIXME: mono defines its own constructor here
+#if BUG_78521_FIXED
+ public MyPage ()
+#else
+ protected override void OnPreInit (EventArgs e)
+#endif
+ {
+ WebTest t = WebTest.CurrentTest;
+ if (t != null)
+ t.Invoke (this);
+ }
+
+ public override void VerifyRenderingInServerForm (Control c)
+ {
+
+ }
+}
-<%@ Page Language="C#" MasterPageFile="MyDerived.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>\r
-\r
-<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>\r
-\r
-<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">\r
- Page main text\r
-</asp:content>\r
-\r
-<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">\r
- <form id="form1" runat="server" >\r
- </form>\r
-</asp:content>\r
+<%@ Page Language="C#" MasterPageFile="MyDerived.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>
+
+<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">
+ Page main text
+</asp:content>
+
+<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">
+ <form id="form1" runat="server" >
+ </form>
+</asp:content>
-<%@ Page Language="C#" MasterPageFile="My.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>\r
-\r
-<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>\r
-\r
-<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">\r
- Page main text\r
-</asp:content>\r
-\r
-<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">\r
- <form id="form1" runat="server" >\r
- </form>\r
-</asp:content>\r
+<%@ Page Language="C#" MasterPageFile="My.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>
+
+<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">
+ Page main text
+</asp:content>
+
+<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">
+ <form id="form1" runat="server" >
+ </form>
+</asp:content>
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
- <configSections>\r
- <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
- <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
- <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
- <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
- <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>\r
- <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
- <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
- </sectionGroup>\r
- </sectionGroup>\r
- </sectionGroup>\r
- </configSections>\r
-\r
- <appSettings>\r
- <add key="strvalue" value="str" />\r
- <add key="intvalue" value="123" />\r
- </appSettings>\r
- <system.web>\r
- <siteMap enabled="true"/>\r
- <compilation debug="true" batch="false">\r
- <assemblies>\r
- <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- </assemblies>\r
- </compilation>\r
-\r
-\r
-\r
- <httpHandlers>\r
- <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
- <remove verb="*" path="*.asmx"/>\r
- <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>\r
- </httpHandlers>\r
- <pages enableSessionState="false">\r
- <controls>\r
- <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- </controls>\r
- </pages>\r
- <membership defaultProvider="FakeProvider">\r
- <providers>\r
- <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
- enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
- applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
- maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
- minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
- passwordStrengthRegularExpression="" />\r
- </providers>\r
- </membership>\r
- </system.web>\r
- <system.web.extensions>\r
- <scripting>\r
- <webServices>\r
- <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->\r
- <!--\r
- <jsonSerialization maxJsonLength="500">\r
- <converters>\r
- <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>\r
- </converters>\r
- </jsonSerialization>\r
- -->\r
- <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->\r
- <!--\r
- <authenticationService enabled="true" requireSSL = "true|false"/>\r
- -->\r
- <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved\r
- and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and\r
- writeAccessProperties attributes. -->\r
- <!--\r
- <profileService enabled="true"\r
- readAccessProperties="propertyname1,propertyname2"\r
- writeAccessProperties="propertyname1,propertyname2" />\r
- -->\r
- </webServices>\r
- <!--\r
- <scriptResourceHandler enableCompression="true" enableCaching="true" />\r
- -->\r
- </scripting>\r
- </system.web.extensions>\r
-\r
- <system.net>\r
- <mailSettings>\r
- <smtp from="heh@heh.com">\r
- <network host="localhost" port="125"/>\r
- </smtp>\r
- </mailSettings>\r
- </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+ <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+ <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+ <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
+ <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ </sectionGroup>
+ </sectionGroup>
+ </sectionGroup>
+ </configSections>
+
+ <appSettings>
+ <add key="strvalue" value="str" />
+ <add key="intvalue" value="123" />
+ </appSettings>
+ <system.web>
+ <siteMap enabled="true">
+ <providers>
+ <add name="TestSiteMapProvider" type="Tests.TestSiteMapProvider" />
+ </providers>
+ </siteMap>
+ <compilation debug="true" batch="false">
+ <assemblies>
+ <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ </assemblies>
+ </compilation>
+
+
+
+ <httpHandlers>
+ <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+ <remove verb="*" path="*.asmx"/>
+ <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
+ </httpHandlers>
+ <pages enableSessionState="false">
+ <controls>
+ <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ </controls>
+ </pages>
+ <membership defaultProvider="FakeProvider">
+ <providers>
+ <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+ enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+ applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+ maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+ minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+ passwordStrengthRegularExpression="" />
+ </providers>
+ </membership>
+ </system.web>
+ <system.web.extensions>
+ <scripting>
+ <webServices>
+ <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
+ <!--
+ <jsonSerialization maxJsonLength="500">
+ <converters>
+ <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
+ </converters>
+ </jsonSerialization>
+ -->
+ <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
+ <!--
+ <authenticationService enabled="true" requireSSL = "true|false"/>
+ -->
+ <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
+ and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
+ writeAccessProperties attributes. -->
+ <!--
+ <profileService enabled="true"
+ readAccessProperties="propertyname1,propertyname2"
+ writeAccessProperties="propertyname1,propertyname2" />
+ -->
+ </webServices>
+ <!--
+ <scriptResourceHandler enableCompression="true" enableCaching="true" />
+ -->
+ </scripting>
+ </system.web.extensions>
+
+ <system.net>
+ <mailSettings>
+ <smtp from="heh@heh.com">
+ <network host="localhost" port="125"/>
+ </smtp>
+ </mailSettings>
+ </system.net>
+</configuration>
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
- <appSettings>\r
- <add key="strvalue" value="str" />\r
- <add key="intvalue" value="123" />\r
- </appSettings>\r
- <system.web>\r
- <siteMap enabled="true"/>\r
- <compilation debug="true" batch="false">\r
- </compilation>\r
-\r
-\r
-\r
- <httpHandlers>\r
- <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
- </httpHandlers>\r
- <pages enableSessionState="false" />\r
- <membership defaultProvider="FakeProvider">\r
- <providers>\r
- <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
- enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
- applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
- maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
- minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
- passwordStrengthRegularExpression="" />\r
- </providers>\r
- </membership>\r
- </system.web>\r
- <system.net>\r
- <mailSettings>\r
- <smtp from="heh@heh.com">\r
- <network host="localhost" port="125"/>\r
- </smtp>\r
- </mailSettings>\r
- </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="strvalue" value="str" />
+ <add key="intvalue" value="123" />
+ </appSettings>
+ <system.web>
+ <siteMap enabled="true"/>
+ <compilation debug="true" batch="false">
+ </compilation>
+
+
+
+ <httpHandlers>
+ <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+ </httpHandlers>
+ <pages enableSessionState="false" />
+ <membership defaultProvider="FakeProvider">
+ <providers>
+ <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+ enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+ applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+ maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+ minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+ passwordStrengthRegularExpression="" />
+ </providers>
+ </membership>
+ </system.web>
+ <system.net>
+ <mailSettings>
+ <smtp from="heh@heh.com">
+ <network host="localhost" port="125"/>
+ </smtp>
+ </mailSettings>
+ </system.net>
+</configuration>
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
- <configSections>\r
- <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
- <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
- <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
- <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
- <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>\r
- <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
- <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
- </sectionGroup>\r
- </sectionGroup>\r
- <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, System.Web_test_net_2_0" />\r
- </sectionGroup>\r
- </configSections>\r
- <appSettings>\r
- <add key="strvalue" value="str" />\r
- <add key="intvalue" value="123" />\r
- </appSettings>\r
- \r
- <!-- DO NOT REMOVE: USED BY TESTS -->\r
- <CustomTags>\r
- <sections>\r
- <add area="activityTemplateTitle">\r
- <add name="a" />\r
- </add>\r
- <add area="Something">\r
- </add>\r
- </sections>\r
- </CustomTags>\r
- \r
- <system.web>\r
- <siteMap enabled="true"/>\r
- <compilation debug="true" batch="false" numRecompilesBeforeAppRestart="100000">\r
- <assemblies>\r
- <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- </assemblies>\r
- </compilation>\r
- <httpHandlers>\r
- <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
- <remove verb="*" path="*.asmx"/>\r
- <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>\r
- </httpHandlers>\r
- <pages enableSessionState="false">\r
- <controls>\r
- <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
- </controls>\r
- </pages>\r
- <membership defaultProvider="FakeProvider">\r
- <providers>\r
- <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
- enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
- applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
- maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
- minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
- passwordStrengthRegularExpression="" />\r
- </providers>\r
- </membership>\r
- </system.web>\r
- <system.web.extensions>\r
- <scripting>\r
- <webServices>\r
- <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->\r
- <!--\r
- <jsonSerialization maxJsonLength="500">\r
- <converters>\r
- <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>\r
- </converters>\r
- </jsonSerialization>\r
- -->\r
- <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->\r
- <!--\r
- <authenticationService enabled="true" requireSSL = "true|false"/>\r
- -->\r
- <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved\r
- and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and\r
- writeAccessProperties attributes. -->\r
- <!--\r
- <profileService enabled="true"\r
- readAccessProperties="propertyname1,propertyname2"\r
- writeAccessProperties="propertyname1,propertyname2" />\r
- -->\r
- </webServices>\r
- <!--\r
- <scriptResourceHandler enableCompression="true" enableCaching="true" />\r
- -->\r
- </scripting>\r
- </system.web.extensions>\r
- <system.net>\r
- <mailSettings>\r
- <smtp from="heh@heh.com">\r
- <network host="localhost" port="125"/>\r
- </smtp>\r
- </mailSettings>\r
- </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+ <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+ <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+ <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
+ <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ </sectionGroup>
+ </sectionGroup>
+ <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, System.Web_test_net_2_0" />
+ </sectionGroup>
+ </configSections>
+ <appSettings>
+ <add key="strvalue" value="str" />
+ <add key="intvalue" value="123" />
+ </appSettings>
+
+ <!-- DO NOT REMOVE: USED BY TESTS -->
+ <CustomTags>
+ <sections>
+ <add area="activityTemplateTitle">
+ <add name="a" />
+ </add>
+ <add area="Something">
+ </add>
+ </sections>
+ </CustomTags>
+
+ <system.web>
+ <siteMap enabled="true">
+ <providers>
+ <add name="TestSiteMapProvider" type="Tests.TestSiteMapProvider" />
+ </providers>
+ </siteMap>
+ <compilation debug="true" batch="false" numRecompilesBeforeAppRestart="100000">
+ <assemblies>
+ <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ </assemblies>
+ </compilation>
+ <httpHandlers>
+ <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+ <remove verb="*" path="*.asmx"/>
+ <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
+ </httpHandlers>
+ <pages enableSessionState="false">
+ <controls>
+ <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+ </controls>
+ </pages>
+ <membership defaultProvider="FakeProvider">
+ <providers>
+ <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+ enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+ applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+ maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+ minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+ passwordStrengthRegularExpression="" />
+ </providers>
+ </membership>
+ </system.web>
+ <system.web.extensions>
+ <scripting>
+ <webServices>
+ <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
+ <!--
+ <jsonSerialization maxJsonLength="500">
+ <converters>
+ <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
+ </converters>
+ </jsonSerialization>
+ -->
+ <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
+ <!--
+ <authenticationService enabled="true" requireSSL = "true|false"/>
+ -->
+ <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
+ and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
+ writeAccessProperties attributes. -->
+ <!--
+ <profileService enabled="true"
+ readAccessProperties="propertyname1,propertyname2"
+ writeAccessProperties="propertyname1,propertyname2" />
+ -->
+ </webServices>
+ <!--
+ <scriptResourceHandler enableCompression="true" enableCaching="true" />
+ -->
+ </scripting>
+ </system.web.extensions>
+ <system.net>
+ <mailSettings>
+ <smtp from="heh@heh.com">
+ <network host="localhost" port="125"/>
+ </smtp>
+ </mailSettings>
+ </system.net>
+</configuration>
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
- <appSettings>\r
- <add key="strvalue" value="str" />\r
- <add key="intvalue" value="123" />\r
- </appSettings>\r
- <system.web>\r
- <siteMap enabled="true"/>\r
- <compilation debug="true" batch="false">\r
- </compilation>\r
- <httpHandlers>\r
- <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
- </httpHandlers>\r
- <pages enableSessionState="false" />\r
- <membership defaultProvider="FakeProvider">\r
- <providers>\r
- <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
- enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
- applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
- maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
- minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
- passwordStrengthRegularExpression="" />\r
- </providers>\r
- </membership>\r
- </system.web>\r
- <system.net>\r
- <mailSettings>\r
- <smtp from="heh@heh.com">\r
- <network host="localhost" port="125"/>\r
- </smtp>\r
- </mailSettings>\r
- </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="strvalue" value="str" />
+ <add key="intvalue" value="123" />
+ </appSettings>
+ <system.web>
+ <siteMap enabled="true"/>
+ <compilation debug="true" batch="false">
+ </compilation>
+ <httpHandlers>
+ <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+ </httpHandlers>
+ <pages enableSessionState="false" />
+ <membership defaultProvider="FakeProvider">
+ <providers>
+ <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+ enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+ applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+ maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+ minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+ passwordStrengthRegularExpression="" />
+ </providers>
+ </membership>
+ </system.web>
+ <system.net>
+ <mailSettings>
+ <smtp from="heh@heh.com">
+ <network host="localhost" port="125"/>
+ </smtp>
+ </mailSettings>
+ </system.net>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode url="sub1.aspx" title="Sub 1" description="">
+ <siteMapNode url="sub_sub1.aspx" title="Sub Sub 1" description="" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode url="test2.aspx" title="Test 2" description="Test Two" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode siteMapFile="~/sub_map_01.sitemap" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode url="test2.aspx" title="Test 2" description="Test Two" />
+ </siteMapNode>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNodeBroken>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode url="test2.aspx" title="Test 2" description="Test Two" />
+ </siteMapNodeBroken>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode url="test2.aspx" title="Test 2" description="Test Two" />
+ </siteMapNode>
+
+ <siteMapNode>
+ <siteMapNode url="test3.aspx" title="Test 3" description="Test Three" />
+ <siteMapNode url="test4.aspx" title="Test 4" description="Test Four" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode provider="TestSiteMapProvider" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One" />
+ <siteMapNode provider="NonExistentSiteMapProvider" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+ <siteMapNode>
+ <siteMapNode url="test1.aspx" title="Test 1" description="Test One"
+ keywords="some, keyword, another, one" />
+ <siteMapNode url="test2.aspx" title="Test 2" description="Test Two"
+ someattribute="value" />
+ </siteMapNode>
+</siteMap>
--- /dev/null
+using System;
+using System.Collections.Specialized;
+using System.Web;
+
+namespace Tests {
+ public class TestSiteMapProvider : StaticSiteMapProvider {
+ object rootNodeLock = new object();
+ SiteMapNode rootNode = null;
+
+ public override SiteMapNode RootNode {
+ get { return BuildSiteMap(); }
+ }
+
+ protected override SiteMapNode GetRootNodeCore() {
+ return BuildSiteMap();
+ }
+
+ protected override void Clear() {
+ lock (rootNodeLock) {
+ rootNode = null;
+ base.Clear();
+ }
+ }
+
+ public override SiteMapNode BuildSiteMap () {
+ lock (rootNodeLock) {
+ if(rootNode == null) {
+ rootNode = new SiteMapNode(this, "Test", "default.aspx", "Test");
+ AddNode(rootNode);
+ }
+ return rootNode;
+ }
+ }
+ }
+}
\ No newline at end of file