Thursday, December 30, 2010
Configuring SSO (Single Sign On ) in Sharepoint 2007
1. Create the SSO service account -- This is the account that the service will run under.
2. Create the SSO groups -- These groups are used to control who has the ability to administer SSO (export the master key) and who has the ability to manage it (add/remove application definitions.)
3. Configure the SSO Service - Set SSO to start and get it to use the service account.
4. Configure SQL Server - Authorize the SSO service account to SQL server.
5. Manage SSO - Setup SSO in MOSS including the groups and the database.
6. Manage the encryption key -- Create the encryption key that will be used for protecting the username and password information on the system.
7. Manage settings for enterprise application definitions -- Define what initial applications SSO will be setup to manage passwords for.
Adding Validation to a Custom List Control in Sharepoint
Recently, one of the requirements was to put validation to a custom List control such as Email field validation.
This validation can be achieved from inside the SharePoint designer.
Following is a step by step walkthrough to validate a list field.
Background
You should know how to create a sharepoint list and how to open the site in sharepoint designer.
1. Following is a list with Email fields. Let's say we have to validate so that only a valid email can be entered.
If not valid, then the Error Message appears next to the field:
2. Now open the site in the sharepoint designer and then expand the list and open the Newform.aspx of the list to be validated:
3. As you can see in the image above, the Newform.aspx of Validation list is being opened in the sharepoint designer.
4. Now right click on this Validation list Web part in sharepoint designer and choose Web Part properties:
5. The properties dialog box will open for the Validation list here. Choose Hidden under layout and say OK.
(This web part can be deleted as well, but due to some known problems because of deletion, it is best to hide this).
6. Now click exactly underneath the hidden list web part and go to Insert->Sharepoint Controls-> Custom List Form… and the Wizard will ask to choose a list or Document Library form based on existing list.
Choose your Validation list and select New item form under type of form to create option and hit Ok.
7. You will get the Validation list underneath the hidden list as shown as selected image below:
8. Now from here, we can customize all the controls based on requirement. As we are customizing the E-Mail field, right click on the email field box and choose Show common control tasks from the context menu:
9. This will give you Common Formfield tasks option as shown below next to the Email field. Here we can change the format of the data field selected (default is list form field). As we need Email field to be textbox where validation can be applied, Choose Textbox from Format as dropdown instead of list form field.
10. After the above step, list will look like this (custom formatted):
11. Now drop a RegularExpressionValidator control from the Validation option under ASP.NET controls from the toolbar as shown below:
12. Now specify the required properties (such as ControlToValidate, ErrorMessage, SetFocusOnError to true, Validate Expression) of the RegularExpressionValidator from the Tag Properties toolbar. For ControlToValidate, choose the ID of the Email field.
After selecting it and getting the ID from the Tag Properties toolbar as you do in Visual Studio, see below the set attributes in blue for the Email field:
13. Now, save the changes and go back to the list in Internet Explorer and try to type in an invalid email id and you will get the following:
Sharepoint 2007 : Item-level permissions
It interests me because it
* allows you to control ownership of the item
* is only available to Lists but not to Document Libraries
* doesn't use unique permissions but some other mechanism
One thing it mentions is that it only works for users without Manage Lists permission on the list. So even if I manage to unravel its' secrets it isn't a waterproof solution (compared to unique item permissions for example). Still, if SharePoint has the notion of ownership it is definitely worth a closer look ! Maybe there's an opportunity here ?
It definitely isn't security by obscurity; if I navigate directly to an item that's not mine I still can't access it.
Peeking under the hood reveals that this setting is stored in SPList.ReadSecurity and SPList.WriteSecurity. Those MSDN articles contain all the details so I'll try not to be repetitive
ReadSecurity
Possible values:
* 1 - All users have Read access to all items.
* 2 - Users have Read access only to items that they create.
WriteSecurity
Possible values:
* 1 — All users can modify all items.
* 2 — Users can modify only items that they create.
* 4 — Users cannot modify any list item.
What about Document Libraries ?
For a Document Library these properties always have a value of "1" meaning everyone has read and write access (provided their permission level is sufficient). Since there is no interface in the Library Settings they cannot be changed. However nothing is stopping me from writing a few lines of code to update the settings, is there ?
using (SPSite site = new SPSite("http://moss/demo1"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Shared Documents"];
list.ReadSecurity = 2;
list.WriteSecurity = 2;
list.Update();
}
}
Guess what ? It worked fine in the standard SharePoint Views and queries but not for WebDAV (Explorer View, etc). Probably the reason they only use it on SharePoint Lists.
An opportunity ? Not really since it doesn't act as real security in all scenario's. At least my curiosity is satisfied.
Friday, July 30, 2010
Breaking of Top Link Bar in sharepoint2007
First, let’s talk about the issue that this little jQuery script is going to solve: you probably know if you create subsites in SharePoint sites, those subsites are shown (by default) in the Top Link Bar of the parent site. So the more subsite you’ve got the more items this menu is showing. Life is all good until there are too many items to show in the menu so it’s get too big to fit on the screen. You won’t get an error or something like that of course, but the browser will give the menu the space it needs by adding horizontal scrollbar the page. The screenshot below illustrates this behavior: the top link bar has too many menu items making it pretty hard to access for example the Site Actions menu (you need to scroll to the right).
So how can this be solved with the help of jQuery? Well besides a very powerful DOM Selectors API, the jQuery library also has a DOM Maniplation API. This Manipulation API can change the HTML that’s rendered in the browser, by adding elements, removing elements etc. The idea is to write a Javascript function that adds a second Top Link Bar to the page’s DOM. The easiest way to accomplish this is to just copy the existing Top Link Bar entirely:
$("#zz1_TopNavigationMenu").clone(true).insertAfter($("#zz1_TopNavigationMenu")).attr("id", "zz1_TopNavigationMenuCopy");
This jQuery script will:
$("#zz1_TopNavigationMenu") select the element with ID zz1_TopNavigationMenu
.clone(true) clone that element
.insertAfter($("#zz1_TopNavigationMenu")) insert the cloned element after the original menu
.attr("id", "zz1_TopNavigationMenuCopy"); set the ID attribute to a new value to be able to identify it uniquely
The result of this function is a page that shows two identical menu bars:
.NET PROJECT DEPLOYMENT ISSUES
Showing a modal dialog box or form when the application is runing in userinteractive mode is not valid operation
Reasons For This Error :
1.In Web Applications, when you create a Modal Dialog Box using MsgBox or MessageBox, even it would of been shown, it would of been shown in your server, not on the clients computer.
I suggest you to use an ajax:ConfirmButton or ajax:ModalPopup or another Ajax Control spread over the web.
2.Remember that this code is running on the web server in a process that is not running as the currently logged on (to the server) user. Therefore the process will be running under its own Window Station, and will not be able to interact with the desktop in any way. Consequently, you cannot display a MessageBox on the server without setting the flags to indicate that you want to display it on the currently logged in user's Window Station (effectively the default desktop).
This causes the Error.
Solution :
Use ScriptManager Tag
instead of MessageBox.show
Example : ScriptManager.RegisterStartupScript tag
Another Solution :
Take a look at MessageBoxOptions Enumeration. You can specify ServiceNotification, or DefaultDesktopOnly options, for when you have no form.
Here is an example.
MessageBox.Show("Message", "Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, _
MessageBoxOptions.ServiceNotification)
Wednesday, June 23, 2010
Most Frequent asked ASP.NET interview questions and answer
Differences between Inheritance and Instantiation,
Differences between Interface and Abstract class,
Differences between String and String Builder,
Differences between Copy and Clone,
Differences between Encryption and Encoding,
Differences between Overloading and Overriding,
Differences between Delete and Truncate,
Differences between Drop and Truncate,
Differences between Stored Procudure and Function,
Differences between DataSet and Data Reader,
Differences between Response.Redirect and Server.Transfer
Differences between SQL SERVER 2005 and SQL SERVER 2008,
Differences between Protected and Internal,
Differences between Generlazation and Inheritance,
Differences between .DLL and .EXE,
Differences between Runtime Binding and Compile Time Binding,
Differences between WCF and Services,
Differences between User Control and Custom Control,
Differences between ValueType and ReferenceType,
Differences between Constructor and Destructor,
Differences between Debug Class and Trace Class,
Differences between Hash Table and Array List,
Differences between Dispose and Finalize,
Differences between Encapsulation and Abstraction,
Differences between Authentication and Authorization
Click Here to Know the Differences
Courtesy By S.Bhavani,Divya ,G.Somesh.............