Tuesday, April 24, 2007

WebRequest myReq = WebRequest.Create(url);

string
username="username";
string password="password";
string usernamePassword = username + ":" + password;
CredentialCache mycache = new CredentialCache();
mycache.Add(
new Uri(url), "Basic", new NetworkCredential(username, password));
myReq.Credentials = mycache;
myReq.Headers.Add(
"Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));

WebResponse wr = myReq.GetResponse();
Stream receiveStream = wr.GetResponseStream();
StreamReader reader =
new StreamReader(receiveStream, Encoding.UTF8);
string 
content = reader.ReadToEnd();

4/24/2007 2:46:20 PM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [4]  | 
 Monday, April 23, 2007

using Microsoft.SharePoint.Publishing;

SPWeb site = SPContext.Current.Site.OpenWeb(yourSitePath);

if
(PublishingWeb.IsPublishingWeb(site))
{
   PublishingWeb web = PublishingWeb.GetPublishingWeb(site);
   SPFile defaultPage = web.DefaultPage;
}

4/23/2007 4:51:43 PM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [0]  |