I was wondering if you can fake the Uri.Host value of a string. For example, given the following code:

new Uri(url.ToLower()).Host == "example.com"

Is there anyway to have this boolean comparison be true, but at the same time the URL go to a different server than example.com?


There's no intentional or known way, and probably (hopefully) no way at all. If there were, it would be a very serious bug in the .NET framework.

However, note that this only guarantees that the host is actually example.com; it doesn't guarantee that traffic for this URI destined for example.com will actually make it there without interception.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.