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.

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);
}

Journey to MCTS 70-515: Lesson 5 – Themes

Developer Featured Image
Precedence

If you use the StyleSheetTheme attribute, settings can be overridden because properties defined by StyleSheetTheme are applied before a page’s control property set. If you use the Theme attribute, settings cannot be overridden because properties defined by Theme are applied after a page’s properties.

Applying themes take precedence in the following order: -

  1. @ Page directive theme attributes
  2. Web.config <pages Theme=themeName”>
  3. Control attributes
  4. @ Page directive StyleSheetTheme attributes
  5. Web.config <pages StyleSheetTheme=”themeName”>

 

To enable or disable themes in an ASP.NET page the following code directive can be used,

<%@ Page EnableTheming=”false” %>

Skins

A skin file differs from a style sheet in that the skin file uses the attributes of the actual control and not just a set of standard HTML style elements. In addition, skin files will be applied at the control level automatically by ASP.NET. Style elements, on the other hand, can be applied automatically only to HTML items. For ASP.NET controls, you must set the style class manually in your markup code.

Skin files can have two types of skins:

  • Default skins
    A default skin automatically applies to all controls of the same type when a theme is applied to a page. A skin is considered a default skin if it does not have a SkinID attribute.
  • Named skins
    A named skin is a control skin with a SkinID property set to a specific name value. To apply a named skin to a control set the ASP.NET control’s SkinID property.

 Actual Scenario: -

Question 1:

 An ASP.NET application has a default.skin file. All buttons within the application use the default style. If you wanted a help button to have a different style, how could that be done?

a)      Add <asp:Button ID=”Info” /> to the default.skin file
b)      Add <asp:Button ID=”Info” /> to the Signup.aspx page
c)       Add <asp:Button ID=”Help” /> to the default.skin file
d)      Add <asp:Button ID=”Help” /> to the Signup.aspx file
e)      Add <asp:Button SkinID=”Info” /> to the default.skin file
f)       Add <asp:Button SkinID=”Help” /> to the Signup.aspx page

Journey to MCTS 70-515: Lesson 4 – Master Pages

Developer Featured ImagePrecedence

If a property is set on the content page to true but the same property is set to false in the master page then the setting on the master page takes priority.

Referencing Properties

To reference any master page properties from content pages do the following,

  1. Create a public property in the master page code-behind file.
  2. Add the @MasterType declaration to the ASPX content page.
  3. Reference the master page property from the content page by using the syntax Master.<Property_Name>.

Actual Scenario: -

Question 1:

Default.aspx uses a master page named Site.master. You add the following code to the Default.aspx code-behind file to read a Site.master public property named Username.

protected void Page_Load(object sender, EventArgs e)
{
        string s = Master.Username;
}

You need to ensure that Default.aspx can access the Username property. What should you do?

  1. Add the following directive to Default.aspx.
    <%@ MasterType VirtualPath=”~/Site.master” %>
  2. Add the following directive to Default.aspx.
    <%@ PreviousPageType VirtualPath=”~/Site.master” %>
  3. Set the Strict attribute in the @ Master directive of the Site.master page to true.
  4. Set the Explicit attribute in the @ Master directive of the Site.master page to true.

  

Referencing Controls
Apart from properties, controls can also be referenced and updated in the master page from any content page using the Master.FindControl method. You only need to pass this method the name of the control. Master.FindControl returns a Control object that would need to be casted to the correct control type. After this reference is made, you can read or update the object as if it were local to the content page.

The following code (in the Page_Load method of the content page) updates a Label control named lblWebsite in the master page,

Label MyWebsite = (Label)Master.FindControl("lblWebsite");
MyWebsite.Text = "IRTAZAALI.COM";

 

Dynamically Changing Master Pages
Page_PreInit method is the last opportunity to override the default master page setting. This is because after this event the content page binds with the master page preventing it from being changed.

 

Journey to MCTS 70-515: Lesson 3 – Web Configuration files

Developer Featured Image
Processing the Configuration Files

ASP.NET runtime environment builds a cache of the configuration settings for the web application in the following hierarchy:

1. ASP.NET retrieves the Machine.config file settings.

2. ASP.NET adds the settings from the root Web.config file to the cache, overwriting any conflicting settings created earlier with the Machine.config file.

3. If a Web.config file exists in website root, ASP.NET loads the file into the cache, overwriting any existing entries.

4. If a Web.config file exists at the web application level, ASP.NET loads the file into the cache, overwriting any existing settings. The resulting cache contains the settings for this website.

5. If web application subdirectories have a Web.config file that includes settings specific to the files and folders that are contained within the subdirectory then ASP.NET loads respective Web.config file from each subdirectory into the cache, overwriting any existing settings.

Web.config hierarchy

Journey to MCTS 70-515: Lesson 2 – Creating Websites

Creating or Deploying Websites

IIS 7.5 does not support Front Page Server Extensions because it uses WebDAV natively. Therefore HTTP deployment cannot be used to create the website. But you could create a file-system based or FTP website. Of those two, the file-system–based website is preferred.  

If you are creating or deploying the website on a remote server then the remote server must have .NET Framework 4, ASP.NET, and Front Page Server Extensions installed and enabled. Note that Microsoft does not support Front Page Server Extensions on IIS 7.5 and Windows Server 2008 R2. So a new website cannot be created using the HTTP deployment in Visual Studio. If you receive the error message below then create the website by using the file system or FTP.  

Exception:
Unable to create the website ‘http://servername’. The web server does not appear to have FrontPage Server Extensions installed
 

Use FTP deployment only when using a web hosting provider that does not support file-system based websites, WebDAV, or Front Page Server Extensions. This is because by default FTP sends user credentials unencrypted. For security reasons change your password regularly when using FTP deployment to minimize the potential impact of compromised credentials.  


What are ASP.NET Folders?

These are special folders which are protected by ASP.NET. If users attempt to browse any of these folders (except App_Themes), they will receive an HTTP 403 Forbidden error.

App_Browsers, App_Code, App_GlobalResources, App_LocalResources, App_Themes, App_WebReferences, and Bin are the ASP.NET special folders.

Can C# web page and VB web page code exist in the same website?

A web page can only have either Visual Basic or C# code. But you can have both web pages with Visual Basic and C# in the same ASP.NET 4 website project. Only not within a web application project.

Website Compilation

There are two models for compilation, a) dynamic compilation and b) precompilation.

Dynamic Compilation:
ASP.NET automatically compiles the application into an assembly and loads it into the website application domain. This takes a few seconds thus affecting performance for any requests received before ASP.NET has finished compiling the application.  

Precompilation:
The other option is to precompile the website within Visual Studio IDE. The entire website is compiled and checked for build errors. This model allows only the layout code and associated assemblies to be deployed on the web server.

Journey to MCTS 70-515: Lesson 1 – Understanding Web Communications

A Web Server’s Role

A web server provides content while the browser displays it. The web server sends files, html or images, through an HTTP connection to the web browser. The following processes take place when a web server receives a request from a web browser: -

1. Request Verification. Web Servers must be able to verify if the request made is legitimate and not a malformed one. If the latter case exists then the web server ignores the request.

2. SSL Authentication. If a Secure Sockets Layer (SSL) certificate has been applied on the web server and the request was made with HTTPS, the web browser uses that certificate to authenticate the server. All content is encrypted by the web server before returning it to the web browser.

3. User Authentication. If the website requires authorization, the web server verifies if the user has submitted credentials. If the user has not been authenticated then the web server redirects to an authentication form already specified for the website.

4. User Authorization. The user submits login credentials. The web server authenticates the user and verifies if the user is allowed to access the requested content.

5. Handling requests. If the web browser requested static content or was trying to access cached content, the web server can directly respond. But if the web browser requests an ASP.NET page then the request is forwarded to ASP.NET.

6. Error Handling. If a server cannot process the web browser request an error is sent to the web browser. These errors include HTTP status codes.

7. Cache output. Web servers cache output to improve response time of subsequent requests. They also provide caching information to web browsers as to know how long to keep the content cached.

8. Compress output. A web server can compress the content to reduce the bandwidth required before sending the page to the web browser.

9. Logging access. Web servers record usage information for security and performance-monitoring purposes.

The Web Browser’s Role
Following are the actions performed by the web browsers in general: -

1. Sending requests to web server. When url http://www.wordpress.com
is entered the web browser resolves the www.wordpress.com Domain Name System (DNS) address. It then uses HTTP to connect to the server and requests the relevant page, in this that’s the default page.

2. Server Authentication. If the server has an SSL certificate and the request was made with HTTPS, the web browser uses the certificate to authenticate the server and then decrypts future communications.

3. Process the response. If the server sends HTML, the browser retrieves embedded objects, such as images, videos, or animations referenced in the HTML. If the server has sent an error, redirection, or other response, the browser responds appropriately.

4. Displaying HTML and embedded objects. Web browsers use HTML standards to determine how to display a webpage to the user. Because HTML can contain embedded objects, a web browser might have to display dozens of objects to render a single webpage.

5. Run client scripts. Client scripts such as in JavaScript enable interactive and responsive pages without reloading the page.

Understanding the Role of HTTP

HTTP is a text-based communication protocol that is used to request webpages from a web server and send responses back to a web browser. When a webpage is requested, the browser sends a request to the web server.

The request might look like the following:

GET /default.aspx HTTP/1.1

Host: www.microsoft.com

If a website has Distributed Authoring and Versioning (DAV) enabled, many more commands are available, including LOCK and UNLOCK.

Note: WebDAV must be enabled if you want to use source control or versioning database/tool from the webserver. For example a webservice giving access to Visual SourceSafe hosted on the web server.

Follow

Get every new post delivered to your Inbox.