Thursday, February 12, 2009

WebPart: Register tag is added automatically to .ASPX file when you add PPS web part

This observation can be used in other context.
Suppose you've have a .ASPX page in SharePoint 2007 that has Performance Point Dashboard web part. To uses the SharePoint site on a client machine that does not have PPS, remove
%@ Register TagPrefix="WpNS1" Namespace ="Microsoft.PerformancePoint.Scorecards.WebParts" ....

If Client machine has PPS installed, and when you add the PPS web part to your page this entry is automatically added.

Tuesday, February 10, 2009

IIS 7: Resolving Anonymous Logon to SQL from ASP.NET Application deployed on IIS7

If you face an issue wherein your ASP.NET application deployed in IIS7 connects to SQL (SQL Server 2008 Analysis Server) as anonymous user then do the following:-
1. Create a new application pool "MyPool" with Managed Pipeline mode set to classic, Load userprofile set to False and Identity set to custom and using a domain user (and password) that has access to the database.
2. Under 'authorization' of the website itself (this website in now under "MyPool" application pool), have Anonymous set to enabled and ASP.NET impersonate set to disabled.
3. In Web.config, leave impersonation="false".
http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx

Thursday, February 5, 2009

SharePoint: Sharepoint connects as Anonymous User to SQL Analysis Server on a Remote Machine and fails to retrieve data from CUBE

If you are trying to connect to a Remote Analysis Server 2008 (64 Bit) it connects as Anonymous User for one of the reasons.

1) Make sure the Authorization is Windows
2) Try this
In web.config Set
identity impersonate=" false"
When it is “true”
For User's IE , User a/c has to connect/open SQL server It requires kerbero’s website (setting that you do while setup of WebSite:Portnumber)
When it is “false”
For User's IE, website Identity Account has to connect/open SQL server
It does not require kerbero’s website

Monday, February 2, 2009

.NET: Reading Property Values using Reflection

class CA
{
private string _myProperty;
public string MyProperty
{
get
{
MyProperty = "Hello"; return MyProperty;
}
}
}


class ReadPropertyGeneric where T : class
{
Type myType;
T _objClass;
public void ReadAndSetProperty(T objClass)
{
myType = (typeof(T));
_objClass = objClass;
// Get the public properties.
PropertyInfo[] myPropertyInfo = myType.GetProperties(BindingFlags.Public BindingFlags.Instance);
Console.WriteLine("The mumber of public properties is {0}.", myPropertyInfo.Length);
// Display the public properties.
DisplayPropertyInfo(myPropertyInfo);
}
public void DisplayPropertyInfo(PropertyInfo[] myPropertyInfo)
{
// Display information for all properties.
for (int i = 0; i < myPropertyInfo.Length; i++)
{
PropertyInfo myPropInfo = (PropertyInfo)myPropertyInfo[i];
Console.WriteLine("The property name is {0}.", myPropInfo.Name);
Console.WriteLine("The property type is {0}.", myPropInfo.PropertyType);
Console.WriteLine("The property value is {0}.", myPropInfo.GetValue(_objClass, null));
object setValueString = myPropInfo.GetValue(_objClass, null) + "NewValue";
myPropInfo.SetValue(_objClass, setValueString, new object[0]);
}
}

MSDN: U.S. Local Highlights