C# LINQ statement

Hi All,

I'm trying to write a LINQ statement to validate URL's that users navigate to through a WebView in a Windows Store App.

The actual question is at the bottom in bold, just trying to provide as much info as possible, so it is easier to help me.

I have a Json list of URL's that is deserialized into an object.
the Json looks something like this:
[
    { "Url": "*.google.co.za/*" },
    { "Url": "*.microsoft.com" },
    { "Url": "*.experts-exchange.com/*" },
    { "Url": "twitter.com" },
    { "Url": "www.twitter.com" },
    { "Url": "www.facebook.com/hardrockbackpackers" },
    { "Url": "www.yahoo.com" }
]

Open in new window


And my object looks respectively the same.
public class WhiteListItem
    {
        public string Url { get; set; }
    }

private readonly List<WhiteListItem> _whiteListItem = new List<WhiteListItem>();

        private bool _pageIsLoading;

        public List<WhiteListItem> WhiteListItems
        {
            get
            {
                return this._whiteListItem;
            }
            set
            {
                this._whiteListItem.Clear();
                foreach (var whiteListItem in value)
                {
                    this._whiteListItem.Add(whiteListItem);
                }
            }
        }

Open in new window


Then I populate my WhiteListItems property with the json.
this.WhiteListItems = JsonConvert.DeserializeObject<List<WhiteListItem>>(jsonText);

Open in new window


now I need to write a method that check the uri of the WebView to make sure the url is valid. So in my "NavigationStarting" event I have the following:
// Cancel navigation if URL is not allowed.
            if (!IsAllowedUri(args.Uri))
                args.Cancel = true;

Open in new window


Now I need help with the "IsAllowedUri" method. I have the following (Not working, result is always 0) and another problem is how will I handle the *.domain.com and *.domain.com/*:
private bool IsAllowedUri(Uri uri)
        {
            var result = (from whiteListItem in WhiteListItems where uri.ToString().Contains(whiteListItem.Url) select whiteListItem.Url).Count();

            if (result > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

Open in new window


I'm new to c# and I think a LINQ statement is the direction I should go, but I'm not sure.
DickSwartAsked:
Who is Participating?
 
it_saigeDeveloperCommented:
@Fernando, quite right.

@DickSwart,  If you are using the Windows Store App Framework then you cannot use the UriTemplate class.  In .NET 3.5, you need to add a reference for System.ServiceModel.Web.  For .NET 4.5, you need to add a reference for System.ServiceModel.

I have attached an example project.

-saige-
EE-Q28649607.zip
0
 
Fernando SotoRetiredCommented:
Hi  DickSwart;

Try this method in place of yours and see if it give you what you need.
private bool IsAllowedUri(Uri uri)
{
    return WhiteListItems.Select(u => u.ToLower()).Any( u => url.ToString().ToLower());
}

Open in new window

0
 
DickSwartAuthor Commented:
Hi Fernando,

Thank you for the quick response, I'm very very new to c#. I get an error:

The type arguments for method 'IEnumarable<TResult> System.Linq.Enumerable.Select<TSource,TResult>(this IEnumerable <TSource>,Func<TSource,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Don't know what this mean. Please Help.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Fernando SotoRetiredCommented:
Hi Hi  DickSwart;

I need some clarification on the URL that are being stored in the WhiteListItem class. Basically these four. Sorry I did not look closely when I first answered the question.

1. "Url": "*.google.co.za/*"  
2. "Url": "*.microsoft.com"
3. "Url": "*.experts-exchange.com/*"
4. "Url": "twitter.com"

Is the meaning of 1, match the string ".google.co.za/" with any characters before after the string which means it may not be a correctly constructed url?

Is the meaning of 2, match the string "*.microsoft.com" with any characters before the string which means it may not be a correctly constructed url?

Is the meaning of 3, the same as 1?

Is the meaning of 4, just the string "twitter.com" and no other characters before or after it?

Can you be a little be more specific on how the string stored in WhiteListItem is formatted.
0
 
DickSwartAuthor Commented:
Maybe this is a bit clearer:

I have a model class as below
public class WhiteListItem
    {
        public string Url { get; set; }
    }

Open in new window


Then I create a list of "WhiteListItem" as such:
    var url1 = new WhiteListItem() {Url = "*.aaaaa.com/*"};
    var url2 = new WhiteListItem() { Url = "www.bbbbb.com/*" };
    var url3 = new WhiteListItem() { Url = "www.ccccc.com" };
    var url4 = new WhiteListItem() { Url = "www.ddddd.com/ddddddd" };

    var validUrls = new List<WhiteListItem> {url1, url2, url3, url4};

Open in new window


And I need the followin results for given URL's:

True - mobi.aaaaa.com/Something
False - aaaaa.com (Because no sub-domain present)
True - www.bbbbb.com
False - mobi.bbbbb.com (Because only www sub-domain allowed)
True - www.ccccc.com
False- dev.ccccc.com
False- dev.ddddd.com/ddddddd (Because only www sub-domain allowed)
False- www.ddddd.com/ddddddd/somethingelse (Because only ddddddd path allowed)

This is just 'n short list of my ALLOWED url's, there are more than 100 valid url's.

Hope this makes more sence.
0
 
Fernando SotoRetiredCommented:
Apparently this function Will be doing more than just string comparison so some kind of rules are required to figure out what is valid and what is not.

What is the meaning of the "*" in something like the following?

"*.aaaaa.com/*"

You state that it could be the following strings
True - mobi.aaaaa.com/Something
False - aaaaa.com (Because no sub-domain present)

Would something like the following be OK.
abcd.aaaaa.com

What are the business rules needed to know what is good and what is bad.

I also noticed that none of these have protocols attached to the beginning such as http, https, ftp are we ignoring this part of the URL?
0
 
it_saigeDeveloperCommented:
For clarification:

*.aaaaa.com/* with  aaaaa.com = false (Because no sub-domain present)
but
www.bbbbb.com/* with www.bbbbb.com = true???

Your mask requirements for /* means subdomain required don't match from one instance to another.

Please clarify.

Thanks,

-saige-
0
 
DickSwartAuthor Commented:
Yes,

abcd.aaaaa.com

Is valid, and we are ignoring the protocols.
0
 
DickSwartAuthor Commented:
Hi it_saige,

Thanx for joining, that is my bad. It should be:

*.aaaaa.com/* with  aaaaa.com = true

@Fernando Soto - Thinking again about the protocols, It can either be http or https, ftp is never allowed.
0
 
it_saigeDeveloperCommented:
Thats not the part I wanted clarification on.  A standard URI is divided up into five distinct parts (with a few sperators):

Take for example: http://domain.com/subdir1/subdir2/page.html?key=value#trash

Part1 = {scheme} this is usually http, ftp, mailto, etc.
Part2 = {host} this is the domain.com
Part3 = {path} this is the subdir1/subdir2/page.html
Part4 = {query} this is the key=value
Part5 = {fragment} this is the trash

In your examples above, I understand that you do not care about the scheme, the query or the fragment.  As such, you want to match the host using a wildcard or explicit value.  Your wildcard is the *.  For the path, again you want to match using a wildcard or explicit value.  However, in your example above, you stated that the path for the first domain was required but for the second domain it was not, even though you used the wildcard value on both.

-saige-
0
 
Fernando SotoRetiredCommented:
You have not answered all my questions, what are the rules of converting the values in the  WhiteListItem To values coming into the method in the Uri object?
0
 
DickSwartAuthor Commented:
Hi saige and Fernando,

sage:

I think I should take a step back, Lets forget about the examples above and use the following. The Questions you guys have made me realized it is not just a simple if url contains comparison.

If the list contains two domain names that are the same and one have wildcards accosted with it, the one with the wildcards will take preference.

If we have the following:
*.domain.com/*
It will translate to the following:
{scheme} - only http or https
{host} - Any subdomain (Or No subdomain) with a domain name of "domain.com"
{path} - Any path
{query} - Any query
{fragment} - Any fragment
Basicaly as long as the host contains "domain.com" it is a valid URL
Example of URL that will pass above rule:
http://domain.com
http://AnySubDomain.domain.com
http://AnySubDomain.domain.com/subdir1
http://AnySubDomain.domain.com/subdir1/subdir2/page.html?key=value#trash
Example of URL that will NOT pass above rule:
http://subdomain.subdomain.domain.com

www.domain.com/*
It will translate to the following:
{scheme} - only http or https
{host} - Only "www" subdomain (Or No subdomain) with a domain name of "domain.com"
{path} - Any path
{query} - Any query
{fragment} - Any fragment
Example of URL that will pass above rule:
http://domain.com
http://www.domain.com
http://www.domain.com/subdir1
http://www.domain.com/subdir1/subdir2/page.html?key=value#trash
Example of URL that will NOT pass above rule:
http://AnySubDomain.AnySubDomain.domain.com
http://AnySubDomain.domain.com

*.domain.com
It will translate to the following:
{scheme} - only http or https
{host} - Any subdomain (Or No subdomain) with a domain name of "domain.com"
{path} - No path allowed
{query} - No query allowed
{fragment} - No fragment allowed
Example of URL that will pass above rule:
http://domain.com
http://AnySubDomain.domain.com
Example of URL that will NOT pass above rule:
http://subdomain.subdomain.domain.com
http://www.domain.com/subdir1
http://www.domain.com/subdir1/subdir2/page.html?key=value#trash

www.domain.com/SpecificPath/*
It will translate to the following:
{scheme} - only http or https
{host} - Only "www" subdomain (Or No subdomain) with a domain name of "domain.com"
{path} - SpecificPath path
{query} - Any query
{fragment} - Any fragment
Example of URL that will pass above rule:
http://www.domain.com/SpecificPath
http://www.domain.com/SpecificPath/subdir2/page.html?key=value#trash
Example of URL that will NOT pass above rule:
http://domain.com
http://www.domain.com
http://AnySubDomain.AnySubDomain.domain.com
http://AnySubDomain.domain.com
http://AnySubDomain.domain.com/SpecificPath

Fernando Soto

If I understand you correctly - There are no rules for converting the values (Whatever Works). I just need to return "True" if it is a valid URL (Rules Above) and "False" if it does not comply to any of the rules.
0
 
DickSwartAuthor Commented:
Any Help?
0
 
it_saigeDeveloperCommented:
I believe that this is what you are after:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EE_Q28649607
{
	class Program
	{
		private static readonly List<WhiteListItem> _whiteListItem = new List<WhiteListItem>();

		public static List<WhiteListItem> WhiteListItems
		{
			get { return _whiteListItem; }
			set
			{
				_whiteListItem.Clear();
				foreach (var whiteListItem in value)
					_whiteListItem.Add(whiteListItem);
			}
		}

		static void Main(string[] args)
		{
			WhiteListItems.Add(new WhiteListItem() { Url = "*.aaaaa.com/*" });
			WhiteListItems.Add(new WhiteListItem() { Url = "www.bbbbb.com/*" });
			WhiteListItems.Add(new WhiteListItem() { Url = "www.ccccc.com" });
			WhiteListItems.Add(new WhiteListItem() { Url = "www.ddddd.com/ddddddd" });

			string[] tests = { "www.aaaaa.com/something?aaa=something/somethin", "mobi.aaaaa.com/Something", "aaaaa.com", "www.bbbbb.com/something/something", "www.bbbbb.com", "mobi.bbbbb.com", "www.ccccc.com", "dev.ccccc.com", "www.ccccc.com/Something", "www.ddddd.com/ddddddd", "dev.ddddd.com/ddddddd", "www.ddddd.com/ddddddd/somethingelse" };

			foreach (var test in tests)
			{
				Console.WriteLine((from item in WhiteListItems
							    where item.IsAllowedUrl(test)
							    select item).Count() >= 1 ? "{0} is allowed" : "{0} is not allowed", test);
			}
			Console.ReadLine();
		}
	}

	public class WhiteListItem
	{
		private Uri fUri = default(Uri);
		private UriTemplate fUriTemplate = default(UriTemplate);
		private string fUrl = string.Empty;
		private bool fHasWildcardDomain = false;

		public Uri Uri { get { return fUri; } }
		public UriTemplate UriTemplate { get { return fUriTemplate; } }

		public string Url 
		{
			get { return fUrl; }
			set
			{
				if (!string.IsNullOrEmpty(value) && !value.Equals(fUrl))
				{
					fUrl = value;

					if (fUrl.StartsWith("*."))
						fHasWildcardDomain = true;

					if (fUrl.IndexOf("/") != -1)
						fUriTemplate = new UriTemplate(fUrl.Remove(0, fUrl.IndexOf("/")));

					if (!Uri.TryCreate(fUrl, UriKind.Absolute, out fUri))
						Uri.TryCreate(NormalizeUrl(fUrl), UriKind.Absolute, out fUri);
				}
			}
		}

		private string NormalizeUrl(Uri uri)
		{
			var url = UrlToLower(uri);
			url = LimitProtocols(url);
			url = RemoveDuplicateSlashes(url);
			return RemoveTrailingSlashAndEmptyQuery(url);
		}

		private string NormalizeUrl(string url)
		{
			if (url.ToLower().StartsWith("*."))
				url = url.Remove(0, 2);

			if (!url.ToLower().StartsWith("http://") || !url.ToLower().StartsWith("https://"))
				url = string.Format("http://{0}", url);

			return NormalizeUrl(new Uri(url));
		}

		private string RemoveDuplicateSlashes(string url)
		{
			var path = new Uri(url).AbsolutePath;
			return path.Contains("//") ? url.Replace(path, path.Replace("//", "/")) : url;
		}

		private string LimitProtocols(string url)
		{
			return new Uri(url).Scheme == "https" ? url.Replace("https://", "http://") : url;
		}

		private string UrlToLower(Uri uri)
		{
			return HttpUtility.UrlDecode(uri.AbsoluteUri.ToLowerInvariant());
		}

		private string RemoveTrailingSlashAndEmptyQuery(string url)
		{
			return url.TrimEnd(new[] { '?' }).TrimEnd(new[] { '/' });
		}

		public bool IsAllowedUrl(string url)
		{
			var temp = default(Uri);
			if (url.StartsWith("*."))
				url = url.Remove(0, 2);

			if (!(url.StartsWith("http://") || url.StartsWith("https://")))
				url = string.Format("http://{0}", url);

			if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out temp))
				return IsAllowedUrl(temp);

			return false;
		}

		public bool IsAllowedUrl(Uri url)
		{
			bool result = false;
			if (fUri.IsAbsoluteUri && url.IsAbsoluteUri && Uri.Compare(fUri, url, UriComponents.Host | UriComponents.PathAndQuery, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) == 0)
				result = true;
			else if (fUri.IsAbsoluteUri)
				result = ValidateParts(url);
			return result;
		}

		private bool ValidateParts(Uri uri)
		{
			UriComponents validator = default(UriComponents);
			UriComponents comparer = default(UriComponents);

			if (fUri.IsAbsoluteUri)
			{
				if (!string.IsNullOrEmpty(fUri.Host))
					comparer |= UriComponents.Host;

				if (!string.IsNullOrEmpty(fUri.PathAndQuery) && fUriTemplate != null)
					comparer |= UriComponents.PathAndQuery;

				if (uri.IsAbsoluteUri)
				{
					if (!string.IsNullOrEmpty(uri.Host) && uri.Host.Contains(fUri.Host))
						validator |= UriComponents.Host;

					if (fHasWildcardDomain && uri.Host.Split('.').Count() != fUri.Host.Split('.').Count() + 1)
						validator &= ~UriComponents.Host;

					if (!string.IsNullOrEmpty(uri.PathAndQuery) && uri.PathAndQuery.Contains(fUri.PathAndQuery))
						validator |= UriComponents.PathAndQuery;

					if (fUriTemplate != null)
					{
						var matches = fUriTemplate.Match(new Uri(string.Format("http://{0}", fUri.Host)), uri);
						if (matches != null)
							validator |= UriComponents.PathAndQuery;
						else
							validator &= ~UriComponents.PathAndQuery;
					}
				}
			}
			return validator.Equals(comparer);
		}
	}
}

Open in new window

Produces the following output -Capture.JPGTo test even further I will change it to use your latest group of tests and post the results.

-saige-
0
 
it_saigeDeveloperCommented:
Here are with the tests you posted above:Capture.JPGWhich does not pass for all of the above but it is close.  Let me review and post back.

-saige-
0
 
it_saigeDeveloperCommented:
Final edit, I think this does everything you want:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EE_Q28649607
{
	class Program
	{
		private static readonly List<WhiteListItem> _whiteListItem = new List<WhiteListItem>();

		public static List<WhiteListItem> WhiteListItems
		{
			get { return _whiteListItem; }
			set
			{
				_whiteListItem.Clear();
				foreach (var whiteListItem in value)
					_whiteListItem.Add(whiteListItem);
			}
		}

		static void Main(string[] args)
		{
			WhiteListItems.Add(new WhiteListItem() { Url = "*.test1.com/*" });
			WhiteListItems.Add(new WhiteListItem() { Url = "www.test2.com/*" });
			WhiteListItems.Add(new WhiteListItem() { Url = "*.test3.com" });
			WhiteListItems.Add(new WhiteListItem() { Url = "www.test4.com/SpecificPath/*" });

			string[] tests = 
			{ 
				"http://test1.com",
				"http://AnySubDomain.test1.com",
				"http://AnySubDomain.test1.com/subdir1",
				"http://AnySubDomain.test1.com/subdir1/subdir2/page.html?key=value#trash",
				"http://subdomain.subdomain.test1.com",
				"http://www.test1.co.uk",
				"http://www.test1Other.com",
				"http://test2.com",
				"http://www.test2.com",
				"http://www.test2.com/subdir1",
				"http://www.test2.com/subdir1/subdir2/page.html?key=value#trash",
				"http://AnySubDomain.AnySubDomain.test2.com",
				"http://AnySubDomain.test2.com",
				"http://AnySubDomain.test2.co.uk",
				"http://www.test2Other.com",
				"http://test3.com",
				"http://AnySubDomain.test3.com",
				"http://subdomain.subdomain.test3.com",
				"http://subdomain.test3.co.uk",
				"http://www.test3Other.com",
				"http://www.test3.com/subdir1",
				"http://www.test3.com/subdir1/subdir2/page.html?key=value#trash",
				"http://www.test4.com/SpecificPath",
				"http://www.test4.com/SpecificPath/subdir2/page.html?key=value#trash",
				"http://test4.com",
				"http://www.test4.com",
				"http://AnySubDomain.AnySubDomain.test4.com",
				"http://AnySubDomain.test4.com",
				"http://AnySubDomain.test4.com/SpecificPath",
				"http://AnySubDomain.test4.co.uk/SpecificPath",
				"http://www.test4Other.com" 
			};

			foreach (var test in tests)
			{
				Console.WriteLine((from item in WhiteListItems
							    where item.IsAllowedUrl(test)
							    select item).Count() >= 1 ? "{0} is allowed" : "{0} is not allowed", test);
			}
			Console.ReadLine();
		}
	}

	public class WhiteListItem
	{
		private Uri fUri = default(Uri);
		private UriTemplate fUriTemplate = default(UriTemplate);
		private string fUrl = string.Empty;
		private bool fHasWildcardDomain = false;

		public Uri Uri { get { return fUri; } }
		public UriTemplate UriTemplate { get { return fUriTemplate; } }

		public string Url 
		{
			get { return fUrl; }
			set
			{
				if (!string.IsNullOrEmpty(value) && !value.Equals(fUrl))
				{
					fUrl = value;

					if (fUrl.StartsWith("*."))
						fHasWildcardDomain = true;

					if (fUrl.IndexOf("/") != -1)
						fUriTemplate = new UriTemplate(fUrl.Remove(0, fUrl.IndexOf("/")), true);

					if (!Uri.TryCreate(fUrl, UriKind.Absolute, out fUri))
						Uri.TryCreate(NormalizeUrl(fUrl), UriKind.Absolute, out fUri);
				}
			}
		}

		private string NormalizeUrl(Uri uri)
		{
			var url = UrlToLower(uri);
			url = LimitProtocols(url);
			url = RemoveDuplicateSlashes(url);
			return RemoveTrailingSlashAndEmptyQuery(url);
		}

		private string NormalizeUrl(string url)
		{
			if (url.ToLower().StartsWith("*."))
				url = url.Remove(0, 2);

			if (!url.ToLower().StartsWith("http://") || !url.ToLower().StartsWith("https://"))
				url = string.Format("http://{0}", url);

			return NormalizeUrl(new Uri(url));
		}

		private string RemoveDuplicateSlashes(string url)
		{
			var path = new Uri(url).AbsolutePath;
			return path.Contains("//") ? url.Replace(path, path.Replace("//", "/")) : url;
		}

		private string LimitProtocols(string url)
		{
			return new Uri(url).Scheme == "https" ? url.Replace("https://", "http://") : url;
		}

		private string UrlToLower(Uri uri)
		{
			return HttpUtility.UrlDecode(uri.AbsoluteUri.ToLowerInvariant());
		}

		private string RemoveTrailingSlashAndEmptyQuery(string url)
		{
			return url.TrimEnd(new[] { '?' }).TrimEnd(new[] { '/' });
		}

		public bool IsAllowedUrl(string url)
		{
			var temp = default(Uri);
			if (url.StartsWith("*."))
				url = url.Remove(0, 2);

			if (!(url.StartsWith("http://") || url.StartsWith("https://")))
				url = string.Format("http://{0}", url);

			if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out temp))
				return IsAllowedUrl(temp);

			return false;
		}

		public bool IsAllowedUrl(Uri url)
		{
			bool result = false;
			if (fUri.IsAbsoluteUri && url.IsAbsoluteUri && Uri.Compare(fUri, url, UriComponents.Host | UriComponents.PathAndQuery, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) == 0)
				result = true;
			else if (fUri.IsAbsoluteUri)
				result = ValidateParts(url);
			return result;
		}

		private bool ValidateParts(Uri uri)
		{
			UriComponents validator = default(UriComponents);
			UriComponents comparer = default(UriComponents);

			if (fUri.IsAbsoluteUri)
			{
				if (!string.IsNullOrEmpty(fUri.Host))
					comparer |= UriComponents.Host;

				if (!string.IsNullOrEmpty(fUri.PathAndQuery) && fUriTemplate != null)
					comparer |= UriComponents.PathAndQuery;

				if (uri.IsAbsoluteUri)
				{
					if (!string.IsNullOrEmpty(uri.Host) && uri.Host.Contains(fUri.Host))
						validator |= UriComponents.Host;

					if (!string.IsNullOrEmpty(uri.Host) && uri.Host.Split('.').Count() == 2 && uri.Host.Contains(fUri.Host.ToLower().Replace("www.", string.Empty)))
						validator |= UriComponents.Host;

					if (fHasWildcardDomain && uri.Host.Split('.').Count() > fUri.Host.Split('.').Count() + 1)
						validator &= ~UriComponents.Host;

					if (!string.IsNullOrEmpty(uri.PathAndQuery) && uri.PathAndQuery.Contains(fUri.PathAndQuery))
					{
						validator |= UriComponents.PathAndQuery;

						if (uri.PathAndQuery.Equals(fUri.PathAndQuery) && fUriTemplate == null)
							validator &= ~UriComponents.PathAndQuery;
					}

					if (fUriTemplate != null)
					{
						var matches = fUriTemplate.Match(new Uri(string.Format("http://{0}", fUri.Host)), uri);
						if (matches != null)
							validator |= UriComponents.PathAndQuery;
						else
							validator &= ~UriComponents.PathAndQuery;
					}
				}
			}
			return validator.Equals(comparer);
		}
	}
}

Open in new window

Produces the following output -Capture.JPG-saige-
0
 
DickSwartAuthor Commented:
Hi Saige,

Thanx a million, Just want to know what does "UriTemplate" type look like and where did you add it.

I copied your code to a blank console app.
0
 
DickSwartAuthor Commented:
My App is a windows 8.1 store app. I added your WhiteListItem class, but looks like system.web namespace and UriTemplate type is not available.

Any Idea how to get around this?
0
 
it_saigeDeveloperCommented:
UriTemplate is a member of the System name space starting with .NET 3.5.  The problem here is that your project is targeting a framework that is too low.Capture.JPGCapture.JPG
Also, you have to add a reference to System.Web.Capture.JPGCapture.JPG-saige-
0
 
DickSwartAuthor Commented:
Great I'm going to check it out.

In the meantime here is a link to what I came up with, I would apprciate it if you can have a look and give me your thoughts.
https://www.dropbox.com/s/eczof22micg1bzm/WhiteListApp.zip?dl=0

I know it is messy, and most properly not 100% correct. That's why I ask for your thoughts to help me improve my coding.
0
 
DickSwartAuthor Commented:
Still nothing, attached screenshot. Is it not possible to do this in .Net Framework 4.5 ? (Total nubie, sorry if it is a stupid question).
Capture.PNG
0
 
it_saigeDeveloperCommented:
.NET 4.5 still has UriTemplate in the System namespace.

-saige-
0
 
DickSwartAuthor Commented:
So why is it not available if I try to add it to my project?

Please help me, please. Is it maybe possible to make it work in my project (the link I posted)? and upload it some were?

Please
0
 
Fernando SotoRetiredCommented:
@-saige-, the UriTemplate class is not supported by the Windows Store App framework.
0
 
DickSwartAuthor Commented:
@Fernando Soto: Can you maybe have a look at my solution (Dropbox link) and give me your thoughts and tips.

Not sure if @-saige- had a look already, but I'm running out of time and I have alot more things to do to this app.

I know that time is valuable and I appreciate everything you guys have done up until now.

Please I need a pro's views before I hand it in, just to tidy up things a bit more.

0
 
DickSwartAuthor Commented:
Thank you for your effort.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.