Sunday, October 14, 2012

feature activation code using powershell does not pick appsettings values

This is a  very common scenario where , our deployment guides tend to be useless with automation just because features are activated well using UI in settings of site/site collection  , but fail using powershell.

Here is the solution to this :

using (SPWeb web = properties.Feature.Parent as SPWeb)
SPWebApplication webApp = web.Site.WebApplication;
Configuration config = WebConfigurationManager.OpenWebConfiguration("/", webApp.Name);
// App settings are retrieved this way

// Connection string settings are retrieved this way


Reference :

Read web.config on FeatureActivated event while activating Feature using PowerShell


Wednesday, October 10, 2012

Get Dependent files from HTML response


I am getting response of a page like :

System.Net.HttpWebRequest  request  ...


request.Method = ...

request.UserAgent =..


receiveStream = response.GetResponseStream();

readStream = new StreamReader(receiveStream, Encoding.UTF8);

string pageContent = readStream.ReadToEnd();

Now out of this string pageContent    , I want to extract all sub request and make them a hit.   Is there something better than html agility pack for this ?

Reply 1 By

I usually read it into an htmlDocument Class and the use either GetElementByID or GetElementsByTagname()




string pageContent;





Reply 2 

You should try

I am searching something better dear.