TF30063: You are not authorized to access tfs\projects

TF30063 Access Unauthorized on TFS

Now thats an issue that can bamboozle the Windows Administrator also :)

Thanks to Ryan Hanisco’s blog,  http://ryanhanisco.com/2011/03/14/tfs-service-authentication-tf30063/, I resolved this issue.

Simple steps performed were: -

  • Click Start, click Run, type regedit, and then click OK.
  • Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  • Create new Multi-String Value and name it as BackConnectionHostNames
  • In the Value data box, type the CNAME or the DNS alias, that is used for the local shares on the computer, and then click OK.
    Note
    - Type each host name on a separate line.
    - If the BackConnectionHostNames registry entry already exists as a REG_DWORD type then delete and recreate as Multi-String Value.
  • Exit Registry Editor, and then restart the computer.

Unable to cast object of type ‘System.Byte[]‘ to type ‘System.Drawing.Image’.

I had saved a logo in a varbinary field for report header. While using ActiveReports, I placed a picture object and on reportstart method tried to assign the DataRow image column to this object. Kept getting the Unable to cast of object type ‘System.Byte[]‘ to type ‘System.Drawing.Image‘ exception.

Finally resolved it using MemoryStream. Here is the code excerpt,

byte[] imgData = (byte[])dt.Rows[0]["MyLogo"];
MemoryStream ms = new MemoryStream(imgData);
reportLogo.Image = Image.FromStream(ms);

Have fun!

Enumerating a StringBuilder object

While trying to list all the string values within a stringbuilder object, I got an exception saying -

foreach statement cannot operate on variables of type ‘System.Text.StringBuilder’ because ‘System.Text.StringBuilder’ does not contain a public definition for ‘GetEnumerator’

But finally thought of a workaround. Using an array of string object. For example,


StringBuilder sColumns = new StringBuilder();
foreach (DataColumn col in dt.Columns)
{
sColumns.Append(col.ColumnName);
sColumns.Append(",");
}


string[] nameIDs = sColumns.ToString().Split(',');
foreach (string nameID in nameIDs)
{
Debug.WriteLine(nameID);
}

Configuring Office365 smtp on ASP.NET 1.1 web applications

If you are still having that frustrating exception “The transport failed to connect to the server” while trying to use an Office365 smtp server settings with ASP.NET 1.1 websites or web applications, then here is the quick fix.

SmtpMail.SmtpServer = pod0000.outlook.com; //your smtp server
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusing”,”2″);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”, “1″);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusername”, myusername@email.com);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendpassword”, mypassword);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”, 25); //the confusing part is here
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”,”true”);

We know that Office365 uses SSL and the port should be 587 (or 465 in some cases) but unfortunately for some reason 587 port does not work in ASP.NET 1.1 when using CDONTS. So just plain luck, tried port 25 and the emails went through. This scenario only applies to ASP.NET 1.1 whereas ASP.NET 2.0 or later work fine with 587 port.

NetTiers generates methods for custom stored procedures that require nullable parameters

When generating methods for custom stored procedures using NetTiers all the paramters of Int, Decimal, etc get defined as Int32?, Decimal? as nullable parameters.

NetTiers says,

The problem is that a param of a stored procedure is always nullable.  You can’t have it not accept a null, you can however, have it use a default value.  So CodeSmith’s AllowDbNull property on the object is always true.
CSPUseDefaultValForNonNullableTypes, set that to true, and it will attempt to use see if the DefaultValue is not = NULL, then it will not make it a regular value type.  This of course only works for value types.

So the fix was to edit the template and
in section #07. CRUD – Advanced
change the value for CSPUseDefaultValForNonNullableTypes to True.

NetTiers ‘layerExceptionPolicy’ is inaccessible due to its protection level

I kept getting this exception while trying to build the generated classes from NetTiers.

To solve this mystery, here is my 20 cents :)

Open nettiers-2.3.1 (the version I am using) template in CodeSmith Generator Studio and browse to Components>ComponentDataAccess.cst file. You could even open this file in notepad.

In the region Fields you will see the following code,

  private static SecurityContext<<%= className %>> securityContext = new SecurityContext<<%= className %>>();
  private static readonly string layerExceptionPolicy = “<%= ComponentPattern %>ExceptionPolicy”;
  private static readonly bool noTranByDefault = false;

Change the highlighted code to the following

  protected static readonly string layerExceptionPolicy = “<%= ComponentPattern %>ExceptionPolicy”;

 

Handler Mappings for ActiveReports 3.0 on IIS7

If you are still facing that 404 – File Not Found exception when trying to open an ActiveReport in a ASP.NET 2.0 integrated website in a IIS7 hosting, then try the following mappings  – tried and verified -

<system.web>
…..
…..
<httpHandlers>
      <add verb=”*” path=”*.rpx” type=”DataDynamics.ActiveReports.Web.Handlers.RpxHandler, ActiveReports.Web, Version=5.3.1436.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff” />
      <add verb=”*” path=”*.ActiveReport” type=”DataDynamics.ActiveReports.Web.Handlers.CompiledReportHandler, ActiveReports.Web, Version=5.3.1436.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff” />
      <add verb=”*” path=”*.ArCacheItem” type=”DataDynamics.ActiveReports.Web.Handlers.WebCacheAccessHandler, ActiveReports.Web, Version=5.3.1436.1, Culture=neutral, PublicKeyToken=cc4967777c49a3ff” />
</httpHandlers>
…..
…..

<system.webServer>
…..
…..
<handlers accessPolicy=”Read, Execute, Script”>
      <add name=”ActiveReports RPX Handler” path=”*.rpx” verb=”*” type=”DataDynamics.ActiveReports.Web.Handlers.RpxHandler” resourceType=”Unspecified” requireAccess=”Script” />
      <add name=”ActiveReports WebCache Handler” path=”*.ArCacheItem” verb=”*” type=”DataDynamics.ActiveReports.Web.Handlers.WebCacheAccessHandler” resourceType=”Unspecified” requireAccess=”Script” />
      <add name=”ActiveReports Compiled Report Handler” path=”*.ActiveReport” verb=”*” type=”DataDynamics.ActiveReports.Web.Handlers.CompiledReportHandler” resourceType=”Unspecified” requireAccess=”Script” />
</handlers>

Follow

Get every new post delivered to your Inbox.