namespace System.Web.Routing
{
-#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
-#endif
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RouteCollection : Collection<RouteBase>
if (httpContext.Request == null)
throw new ArgumentException ("The context does not contain any request data.", "httpContext");
-#if NET_4_0
if (Count == 0)
return null;
-#endif
if (!RouteExistingFiles) {
var path = httpContext.Request.AppRelativeCurrentExecutionFilePath;
VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
if (path != "~/" && vpp != null && (vpp.FileExists (path) || vpp.DirectoryExists (path)))
return null;
}
-#if !NET_4_0
- if (Count == 0)
- return null;
-#endif
foreach (RouteBase rb in this) {
var rd = rb.GetRouteData (httpContext);
if (rd != null)
{
if (requestContext == null)
throw new ArgumentNullException ("httpContext");
-#if !NET_4_0
- if (Count == 0)
- return null;
-#endif
VirtualPathData vp = null;
if (!String.IsNullOrEmpty (name)) {
RouteBase rb = this [name];
if (rb != null)
vp = rb.GetVirtualPath (requestContext, values);
-#if NET_4_0
else
throw new ArgumentException ("A route named '" + name + "' could not be found in the route collection.", "name");
-#endif
} else {
foreach (RouteBase rb in this) {
vp = rb.GetVirtualPath (requestContext, values);
{
return write_lock;
}
-#if NET_4_0
public void Ignore (string url)
{
Ignore (url, null);
return route;
}
-#endif
protected override void InsertItem (int index, RouteBase item)
{
// FIXME: what happens wrt its name?