set selected node on treeview asp.net
This article will help you to set the selected node of ASP.NET Tree View based on node text. I did this for my application and it works fine.
Following is the code to select node.
TreeNode node { get; set; }
private TreeNode SelectNode(string nodetext, TreeNodeCollection parentCollection)
{
foreach (TreeNode childnode in parentCollection)
{
//iterate through the treeview nnode
if (childnode.Text == nodetext)
{
node = childnode;
}
else if (childnode.ChildNodes.Count > 0)
{
// check for child item(level 2)
node = GetNode(nodetext, childnode.ChildNodes);
}
//if Match found return node
if ((node != null)) break;
}
return node;
}
Here is the way to call the function and set the selected node.
TreeNode node1 = SelectNode(“nodetext”, tvMenu.Nodes);
if (node1 != null)
{
node1.Selected = true;
}
RiaContext.Current.Authentication.User is NULL.
From last two days i was looking for the issue “RiaContext.Current.Authentication.User is null” while authenticating user.
The simple code is shown below which works fine on local development server.
private AuthenticationService _userService = RiaContext.Current.Authentication;
_userService.Login(“test”,”test@123″);
_userService.User.Identity.IsAuthenticated always returns False.
After debugging the above on the production server “RiaContext.Current.Authentication.User” returns Null.
Then i use fiddler which gave me following error:
The resource cannot be found.
http://mydomainname.com/ClientBin/DataService.axd/MyAPP-Web-MyDomainService/GetUser.
HTTP 404 : The resource cannot be found.
There are many reasons for the above error:
1.Your application should run in Full Trust Mode.
<system.web>
<trust level=”Full” />
</system.web>
2.Make sure that your web.config contains the following entries:
<handlers>
<add name=”DataService” verb=”GET,POST” path=”DataService.axd” type=”System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ />
</handlers><httpHandlers>
<add path=”DataService.axd” verb=”GET,POST” type=”System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ validate=”false” />
</httpHandlers>3.Above can also happen due to missing assembly reference so make sure that you have all the assemblies installed.
Windows azure security
Security is one of the biggest concerns in the Windows azure.
There are many ways to secure our data in the cloud azure:
1. Access Control Service for securing access to your Azure solutions through a claims-based identity model.
2. Windows azure applications are deployed in Microsoft Data center which gets all the security benefits provided by Microsoft.
3. Authentication and authorization can be implemented by using the ASP.NET membership and role provider or by Access Control Service (ACS), which is part of .NET Services. All the .net security features are applied to windows azure.
4. Using Claim based authentication (Windows Identity Foundation).
Applications determine whether a user is allowed access based on Security Assertion Markup Language (SAML) tokens that are created by the Security Token Service (STS) and contain information about the user. The STS provides a digital signature for each token. Applications have lists of digital certificates for the STSs it trusts. Trust relationships can be created between a trusted STS and an STS that issues a token to provide for identity federation. The Access Control Service is an STS that runs in the cloud. This STS validates the signature on the SAML token that is sent by the client application (such as a web browser) and creates and signs a new token for the client application to present to the cloud application.
5. Sql Azure Security:
Security in SQL Azure is much like security for an on-site SQL Server, so SQL administrators will find security management at the database level to be a familiar task. Server-level administration is a bit different because the databases may span more than one physical system.
SQL Azure provides same level of security that is applicable to SQL Server. All the SQL Azure related security settings are stored in the master database.
Sql azure also provides firewall mechanism that can be used to allow or deny connections to sql azure. To interact with sql azure we need to specify IP ranges that will be used to connect.
You cannot interact with sql azure without any certificate and encryption method which helps in secure transmission of data.
6. Operating System Versioning in Windows Azure:
Operating system versioning is the new feature included in the windows azure services where in customers can choose when their applications receive new operating system updates and patches by selecting which version of the operating system their applications will run on in Windows Azure. Right now there is only one available operating system version (released on December 17th, 2009), but new builds with the latest updates and patches will be released regularly. This new feature allows developers to test their applications when new patches come out before upgrading their production deployments.
Azure is running on Windows Server 2008 and has a custom very-tightly-locked-down web configuration. The server is behind firewalls and load balancers and is running in a highly automated virtualization environment.
Refrerences:
http://www.windowsecurity.com/articles/Microsoft-Azure-Security-Cloud.html
Adding page transition in silverlight 3
This sample shows how to add custom transition in silverlight page(FlipperTransition).
You can download sample here
How to get rid of the “title” column from a SharePoint list
Last week on of my friend asked me about how to remove title column from SharePoint list. The column “Title” is a reserved word in SharePoint. You can rename this column to something else, but It can lead to unexpected behavior of your application. But there is a way by which you can hide this column.
Step 1. Select the list for which you want to hide or remove title column. Let’s work it out with “Tasks” list.

Step 2. Click on Settings and select List Settings. Once on the settings page for your list, click on the advanced settings link as shown below.

Step 3. Here you need to set “Allow management of content types” to “Yes”.

Step 4. Now you will see the Content Types section. Select the content type for which you want to edit “title” Column. Click on the content type name which is Task.

Step 5. Select the Title column from the column list.

Step 6. In the Column Setting section Select the status of this column to “Hidden (Will not appear in forms)” and click OK.

That’s all.Now you will not see title column .
The security validation for this page is invalid
Last week when i was working on sharepoint object model i got an error “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.” .
After playing around it for a long time i found many solutions.
1.Central Administration—>application management—->web application settings–>”Web Page Security Validation” and Turn off security validation.
but the above is not valid as it can lead to security voilation and can be dangerous.
2.Setting AllowUnsafeUpdates to True can resolve problem related to Object Model.
Setting this property to true opens security risks, potentially open to malicious code.
site/web.AllowUnsafeUpdates=true;
//Your code goes here
site/web.AllowUnsafeUpdates=false;
3.Disable the FormDigestSettings for the time of your code execution and should be revert back.
SPSite site = SPContext.Current.Site;
site.WebApplication.FormDigestSettings.Enabled = false;
//Your code goes here..
site.WebApplication.FormDigestSettings.Enabled = true;
//Or you can use following
SPWeb web = site.OpenWeb();
SPWebApplication webApp = web.Site.WebApplication;
webApp.FormDigestSettings.Enabled = false;
//Your code goes here..
webApp.FormDigestSettings.Enabled = true;
4.Call SPUtility.ValidateFormDigest().
SPUtility.ValidateFormDigest();
web.AllowUnsafeUpdates = true;
//Your code goes here..
web.AllowUnsafeUpdates = false;
Hope this helps.
Installing Visual Studio Extensions for Windows SharePoint Services on Windows 7
SharePoint 2007 is a server product and it can only be installed on the Windows Server family platform like windows server 2003/2008.
In a situation when user dont want’s to install sharepoint 2007 on local system but would like to develop locally and deploy on server.It can be done by simply manipulating registry values.
Step 1:Open regedit and navigate to “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0″.If you don’t find it create one.
Step 2:Create a new String Value(REG_SZ) named as sharepoint and set its value to “Installed”
That’s all.
Programatically set image source property in silverlight.
following is one if the way to set Image source programatically in silverlight.
string sURL = “/MYAPP;component/images/hello.png”;
Uri imgURI = new Uri(sURL, UriKind.Relative);
Image1.Source = new BitmapImage(imgURI);
Windows azure
Windows azure is an operating system in the cloud. It is design for utility computing. It provides same features that a desktop computer provides but on a set of connected server storing data on servers in Microsoft data centers. Windows azure runs your application in scale, reliable, available and fault tolerance manner. Microsoft has awesome datacenter so no need to worry about the following as it will be handled by windows azure.
• Buying, configuring hardware
• Buying, configuring software
• Backup and recovery
• Load balancing
• OS
• Patching
• Server acquisition
• Network
• Routers
• Disk drive failure
• Application Deployment
• Capacity Planning
Also managing the above listed thing will be quite expensive. Windows azure lets you focus on application logic.
In windows azure you have many virtual instances of window running your application known as “Fabric Controller”.
Fabric controller detects failure on an application and automatically starts the new instance of an application. It allows applications to run under zero down time.
When we deploy azure application in the cloud azure the fabric controller automatically manages all the instances of application that are running. Application Fabric automatically provisions web or worker role to the application instances. All configurations that are required to run application in cloud azure are handling by Fabric Controller.
Windows azure has storage which stores data in the cloud. It has the following services which are independently accessible and scalable. The azure storage is managed by Microsoft so you can rely on Microsoft for fault tolerance and high availability.
• Blobs – provide a simple interface for storing large files along with metadata for the file. Windows Azure Blob allows us to store large objects, up to 50GB each in the cloud.
• Tables – provide structured storage for maintaining service state. A table is a set of entities, which contain a set of properties. It supports massively scalable tables in the cloud, which can contain billions of entities and terabytes of data. The system will efficiently scale out by automatically scaling to thousands of servers as traffic grows.
• Queues – provide reliable way for service communication. Windows Azure Queue provides a reliable message delivery mechanism. It provides a simple and asynchronous work dispatch mechanism, which can be used to connect different components of a cloud application. The Windows Azure Queues are highly available, durable and performance efficient.

Recent Comments