Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Having the Uri object parse out all unique domains

Using the Uri object to return a list of domain found in the  string

I need to find if Uri (or related .NET object) can return 2 of 3 domains when it parses this string:

https://sso.mydomain.org/openam/?goto=http://evildomain.com/?hacked=mydomain.org:80/ntshome/Home/Index?ClientId=MP";

I would be okay if it returned:

sso.mydomain.org
evildomain.com
mydomain.org:

OR

evildomain.com
mydomain.org

How can I do this with Uri or some other .NET object?

Thanks
SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

That code hurts, just looking at it. I am surprised it's so difficult to extract the following:

sso.mydomain.org/openam/
evildomain.com
mydomain.org
         
and your code does not even create that list.

Is there an easier way? One with code I could modify myself?

I do not code LINQ with SQL commands, so it is especially confusing to me.

Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you very much