Re: using the web in my windows form
- From: "Patrice" <http://www.chez.com/scribe/>
- Date: Fri, 13 Mar 2009 17:40:49 +0100
You have not current client request so you can't of course. Actually you
don't even have ~/ as this is a server side notation....
To me you'll just append the relative URL to the abolsute url of the page
and use the Uri class to cananolize the path ?
You could also use the base href tag (not sure what is the context and why
you need to resolve all links).
--
Patrice
"Jim Johanson" <reply@xxxxxxxxxxxxx> a écrit dans le message de groupe de
discussion : 9hseq4ho9jcuh9m57pgd22gbmo35ui0k8e@xxxxxxxxxx
I'm trying to write an app that can spider a web site.
I'm doing it by calling:
string htmlData = enc.GetString(browser.DownloadData(url));
Then using some regex to parse out the links.
The trick comes when I'm trying to separate local/external links,
fully qualified and non-fully qualified, links with application
relative paths, etc. An example will probably be more clear:
../../file.txt
or
~/pathtoresolve/page.aspx
or
~/pathtoresolve/page.aspx?returnurl=http://servertoredirect/resource.aspx
I'm trying to resolve the link as a fully qualified link. E.G.,
http://www.somedomain.com/application/pathtoresolve/page.aspx
My initial approach (above) works but (once I screen out external
links) still leaves me with the non-fully qualified links, some of
which could be absolute, relative, or application relative.
I was thinking about trying to use "HttpContext.Current.Request.Url"
somehow but I'm not sure about how best to go about it (or if it's
possible, since we're not on the server in the winform then can I even
make reference to any sort of HttpContect?) Conceptually my brain is
not working. Too much of a beginner perhaps.
Any help/suggestions would be appreciated.
.
- Prev by Date: Context Menu items description
- Next by Date: Re: Home folder for project
- Previous by thread: Context Menu items description
- Next by thread: Auto Scroll Control on Panels
- Index(es):
Relevant Pages
|