Tuesday, November 25, 2008

Enable Session in SharePoint

In Web.Config file, modify the following string.

<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" />


<!--<add name="Session" type="System.Web.SessionState.SessionStateModule"/> -->
Change into:

<add name="Session" type="System.Web.SessionState.SessionStateModule"/>


 

Tuesday, October 21, 2008

Wednesday, September 3, 2008

Problem in adding reference of assemblies of GAC?

You can find any dll in gac at local path as given below:

C:\WINDOWS\assembly\GAC_MSIL\<Name of dll>\1.0.0.0__0fcde578cc202cae\<Name of dll>.dll

Note: 1.0.0.0__0fcde578cc202cae is the version name and it differs assembly to assembly.

Thursday, July 31, 2008

Very good Caml Query Builder

http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=28

Sharepoint Tools : Must have


*PowerShell Script Generator*
http://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html

Performance Measurement Tools
DynaTrace
http://www.compuware.com/application-performance-management/dynatrace-test-center.html
Load Runner
http://www8.hp.com/us/en/software-solutions/software.html?compURI=1175451#.UTTRvqKOQy0

Code Maintainance tool(Code ReSharper-)
http://www.jetbrains.com/resharper/

* Online HTML ENCODER*
http://www.opinionatedgeek.com/dotnet/tools/htmlencode/Encode.aspx

*All Connection String Samples*
http://www.connectionstrings.com/

Tools by SysInternals
================
Process Monitor
More details here - http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

and many more here - http://technet.microsoft.com/en-us/sysinternals/bb545027

CamStudio - Captures activity on the screen
=================================
http://download.cnet.com/CamStudio/3000-13633_4-10067101.html


1. Internet Explorer Developer Toolbar : Very good tool for web development
http://www.microsoft.com/DownLoads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en
Steps to enable IEToolbar:

1. Tools-->Internet options --> Security Tab --> Local Intranet --> Custom Level --> Run ActiveX Control or PlugIn (Administrator Mode)

2. Tools --> Internet Options --> Programs --> Manage add-ons --> IE Developer Toolbar --> Enable

3. Tools --> Internet Options --> Advanced --> Enable third party browser-extensions 2. Color Picker
Download "pixiesetup.exe"
3. WebDevelopment Helper
Download "WebDevHelper.msi"
4. U2U caml query builder
Download "U2UCamlCreator.exe"
5. Fiddler
Download "FiddlerSetup.exe"
6. Reflector
Download "Reflector.zip"
7. WSS SDK
Download "wsssdk.exe"

8. SharePoint Solution Generator
Download "VSeWSS.exe"
9. VS2008 WSS Extensions
Download "VSeWSSv12.exe"
10. VS2005 extension for WWF
Download "Visual Studio 2005 Extensions for Windows Workflow Foundation (EN).exe"

Tuesday, July 29, 2008

Session.SessionID uniqueness.

Session.SessionID is unique only after there is some value stored in session.

Otherwise it always give different id at every postback.

Wednesday, July 16, 2008

How to Disable refresh button in web page

// Disable F5 button to disable refresh.

function checkKeyCode(evt)

{


 

var evt = (evt) ? evt : ((event) ? event : null);

var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

if(event.keyCode==116)

{

evt.keyCode=0;

return false

}

}

document.onkeydown=checkKeyCode;


 


 

//Disable Right click

function Disable()

{

if (event.button == 2)

{

return false;

}

}

document.onmousedown=Disable;


 

Note: We cant control the refresh button of browser in general ways.

Sunday, July 13, 2008

WSS3.0 or MOSS2007 : UI Customization references

Heather Solomon - http://www.heathersolomon.com/blog/

How to: Customize the Display of Quick Launch -- http://msdn.microsoft.com/en-us/library/ms466994.aspx

Windows SharePoint Services Default Master Pages -- http://msdn.microsoft.com/en-us/library/ms467402.aspx

http://msdn.microsoft.com/en-us/library/ms476046.aspx

CSS Reference Chart for SharePoint 2007

http://www.heathersolomon.com/content/sp07cssreference.htm#WebParts

WSS3.0, SharePoint2007: Change masterpage(Application.master) at runtime with HTTPModule

http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3580840&SiteID=1

How to create a custom theme in SharePoint2007 or WSS3.0

http://www.heathersolomon.com/blog/articles/create2003theme.aspx

http://ariswibowo.wordpress.com/2007/03/05/creating-moss-2007-theme/

http://www.sharepointblogs.com/tigirry/archive/2007/07/03/custom-site-theme-for-sharepoint-2007-moss-2007-and-wss-3-0.aspx

Wednesday, April 23, 2008

Change password for sharpoint account


stsadm -o updatefarmcredentials -userlogin DomainName\UserName -password NewPassword

By using the command change the password of the farm

stsadm -o updatefarmcredentials -userlogin DomainName\UserName -password NewPassword

Then go to IIS manager of a web server.

Go to application pool of the sites which dont have network service as a application pool's identity

Change the credential for application pool identity(If it is not network service and if it is configurable )

Go to the the web sites,

Properties --> Directory security --> Authentication and access control

change the credential of the user who is used for anonymous access.

Change the password for scheduled tasks on the system(If any.)

Repeat it for all the web sites.

How to add custom people Editor sharepoint control in web page?

Simply, Add following mark up in the page.

"IsValid="true" AllowEmpty="false" Height="20px" Width="200px"
BackColor="Cornsilk" AllowTypeIn="true" MultiSelect="false"
SharePointGroup="Test_Group" />"

Monday, April 14, 2008

How to get currently running asp.net application in iis, with its process id and name?

Here is the command that helps.


 

C:\WINDOWS\system32>iisapp.vbs

W3WP.exe PID: 5080 AppPoolId: SharePoint - 82

Friday, April 11, 2008

Performance monitoring with Task Manager

http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/prork/preb_mon_nbcl.mspx?mfr=true

Tuesday, April 8, 2008

Recycling an Application Pool (IIS 6.0)

http://www.developer.com/net/asp/article.php/2245511

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f11b8294-cc42-4e9c-8482-6257bf3b80f2.mspx?mfr=true

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/989a6b5c-289c-4a7c-95b5-175ee4c27159.mspx?mfr=true

Optimize custom Task Form or WebPage in WSS3.0 – Step By Step Approach

To optimize task form or web page in WSS,

  1. In Task form or web page, use only one SpWeb and SPSite object throught out the page. Avoide creating SPSite or SPWeb objects at multiple places.


     

  2. Always make sure to Dispose the SPSite and SPWeb objects after finish use of it. For this we can follow following coding practice as per situation.
    1. "Using" technique : This is the best technique.

      Here is the sample example for this.

void PublishingWebCollectionBestPractice()

{

using (SPSite siteCollection = new SPSite("http://moss"))

{

using (SPWeb web = siteCollection.OpenWeb())

{

PublishingWeb outerPubWeb = PublishingWeb.GetPublishingWeb(web);

PublishingWebCollection pubWebCollection = outerPubWeb.GetPublishingWebs();

foreach (PublishingWeb innerPubWeb in pubWebCollection)

{

// innerPubWeb referenced so we must call outerPubWeb.Close()

// otherwise, we will leak each and every innerPubWeb object

innerPubWeb.Close();

}

} // SPWeb object web.Dispose() automatically called

} // SPSite object siteCollection.Dispose() automatically called

}

  1. "Finally" – Alternative way.

    Dispose objects in finally clause.

    Here is the sample example.

String str;

SPSite oSPSite = null;

SPWeb oSPWeb = null;

try

{

oSPSite = new SPSite("http://server");

oSPWeb = oSPSite.OpenWeb(..);

str = oSPWeb.Title;

}

catch(Exception e)

{

}

finally

{

if (OurObject != null)

{

OurObject.Dispose();

GC.SuppressFinalize(OurObject);

}

if (OurSiteObject != null)

{

OurSiteObject.RootWeb.Dispose();

OurSiteObject.Dispose();

GC.SuppressFinalize(OurSiteObject);

}

}


 

  1. Whenever required to pass the SPWeb or SPSite Objects, pass by reference (ref parameter). Avoid to pass it by value. It creates multiple objects each time they pass.

        Like

SPWeb sourceWeb = sourceSite.OpenWeb();

string smtpServerName = GetSettingsValue(ref sourceWeb, "SMTPServerName", "String Value");


 


 

Other good references,


 

  1. http://www.webdeveloper.com/forum/archive/index.php/t-154151.html
  2. http://blog.gemsolution.co.uk/2007/06/15/disposing-of-spsite-and-spweb-objects/
  3. http://msdn2.microsoft.com/en-us/library/yh598w02(VS.80).aspx
  4. http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx
  5. http://support.microsoft.com/default.aspx?scid=901259
  6. http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=73
  7. http://209.85.173.104/search?q=cache:jZ-GHkoMd9oJ:blog.developers.ie/cgreen/archive/2006/09/26/2274.aspx+SPWeb.ParentWeb+%2B+Dispose&hl=en&ct=clnk&cd=8&gl=us

CLR Profiler

http://msdn2.microsoft.com/en-us/library/ms979205.aspx -- how to use CLR Profiler for monitor garbage collector.

Wednesday, April 2, 2008

Retrieve the user from people picker control

In continuation of my previous post,

Use following code needed to retrieve the user from people picker control

using
Microsoft.SharePoint.WebControls; //add a reference to Microsoft.SharePoint.dll if needed

public
class MyPage : Page
{
     protected PeopleEditor
indrajeet;

}


public void btnSave_Click(object sender, System.EventArgs e)
{
….
PickerEntity pe = (PickerEntity)
indrajeet.Entities[0]; //gets first user in list
string username = pe.Description;

}

How to add People Picker control to custom application development (ASPX, user controls or web parts)

Add the following lines of code in the form to add PeopleEditor control to your page:


 

<%@ Register
Tagprefix="indrajeet" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


 

< indrajeet:PeopleEditor

AllowEmpty="false"

ValidatorEnabled="true"

id="usrPicker"

runat="server"

ShowCreateButtonInActiveDirectoryAccountCreationMode="true"

SelectionSet="User" />

Friday, March 14, 2008

Special Characters are not allowed as a site URL to create a site

#%&~*":?/><|\}{+

Above special characters are not allowed as a site Url while creating the site.

This is specific to SharePoint site, but it can be in general for all other types of sites also.

Tuesday, March 11, 2008

What Steps to Order your MCP Member Kit?

1.    You must have received an email from MicrosoftLearning@response.microsoft.com after you have completed your Exam with a Certification ID included in it.

[This Certification ID is your MCP ID]

2.    You also need Access Code to complete the process. If you haven't received any such access code. You need to send a mail to MCPHelp@microsoft.com requesting for the same.

3.    Next, visit https://mcp.microsoft.com/mcp and enter this access code along with the MCP ID to have your Microsoft Passport associated with your MCP Record. [Thus you need either msn/hotmail id, if you don't have one. You need to create this one too.] And complete the form.

4.    Now You may order your MCP Member Kit by visiting https://mcp.microsoft.com/mcp/tools/WelcomeKitValidateAddress.aspx

5.    You receive a beautiful certificate signed by Bill gates in next 15-20 working days.

[I have received one; you also deserve it!! so take time and follow the above steps.]

Courtesy by : Harshad Bafna

Wednesday, February 27, 2008

HTML Meta tag

Generally one would think that what is this meta tag in a HTML form??

Here is the answer,

Meta tag in HTML is generally used for three of the following.

  1. Document description

Information inside a meta element describes the document.

  1. Document keywords

Information inside a meta element describes the document's keywords. Which keywords are used by search engine to get information about web pages.

  1. Redirect a user

This example demonstrates how to redirect a user if your site address has changed.

Here is the example for the same

<html>

<head>

<meta http-equiv="Refresh"

content="5;url=http://www.w3schools.com">

</head>

<body>

<p>

Sorry! We have moved! The new URL is: <a href="http://www.w3schools.com">http://www.w3schools.com</a>

</p>

<p>

You will be redirected to the new address in five seconds.

</p>

<p>

If you see this message for more than 5 seconds, please click on the link above!

</p>

</body>

</html>

Courtesy By : www.w3schools.com

Wednesday, January 30, 2008

ASP.Net FileUpload size limit

By default, The maximum size of a file to be uploaded to a server using the ASP.NET FileUpload control is 4MB. You cannot upload anything that is larger than this limit.

To change this size limit, you have to make some changes in the application's web.config:

<system.web>

<httpRuntime maxRequestLength="1048576" executionTimeout="360"/>

</system.web>

maxRequestLength - Attribute limits the file upload size for ASP.NET application. This limit can be used to prevent denial of service attacks (DOS) caused by users posting large files to the server. The size specified is in kilobytes. As mentioned earlier, the default is "4096" (4 MB). Max value is "1048576" (1 GB) for .NET Framework 1.0/1.1 and "2097151" (2 GB) for .NET Framework 2.0.


 

executionTimeout - Attribute indicates the maximum number of seconds that a request is allowed to execute before being automatically shut down by the application. The executionTimeout value should always be longer than the amount of time that the upload process can take.

Thursday, January 17, 2008

ClientScript.RegisterStartupScript

We can run javascript on server side events by using ClientScript.RegisterStartupScript

The sample code shows sample use of the feature.

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Text;


 

public
partial
class
_Default : System.Web.UI.Page

{


protected
void Page_Load(object sender, EventArgs e)

{


StringBuilder sb = new
StringBuilder();


string myMessage = "Hello world!!";

sb.Append("<script language='javascript'>");

sb.Append("alert('" + myMessage + "');<");

sb.Append("/script>");

ClientScript.RegisterStartupScript(this.GetType(), "MsgSummary1", sb.ToString());


 

}

}

Thursday, January 3, 2008

JavaScript: execScript

The function allows u to run scripts at run time

Sample is as below:

<html>
<body>
<script language="JavaScript">
function function1() {
    var m = window.execScript("alert('test');""JavaScript");
    alert("The method returns always "+'"'+m+'"'); 

</script>
<input type="button" value="Click to execute the script" onclick="function1();">
</body>
</html>

javaScript : document.execCommand

By using document.execCommand of javascript,

  1. You can print the current page that is showing in browser.

Javascript for this is : document.execCommand('Print');

  1. You can refresh the page

    Javascript for this is : document.execCommand('Refresh');


     

There are certain set of this kind of commands that can be used in conjution with document.execCommand function are as below:


 

2D-Position

Allows absolutely positioned elements to be moved by dragging.


 

AbsolutePosition

Sets an element's position property to "absolute."


 

BackColor

Sets or retrieves the background color of the current selection.


 

BlockDirLTR

Not currently supported.


 

BlockDirRTL

Not currently supported.


 

Bold

Toggles the current selection between bold and nonbold.


 

BrowseMode

Not currently supported.


 

ClearAuthenticationCache

Clears all authentication credentials from the cache. Applies only to execCommand.


 

Copy

Copies the current selection to the clipboard.


 

CreateBookmark

Creates a bookmark anchor or retrieves the name of a bookmark anchor for the current selection or insertion point.


 

CreateLink

Inserts a hyperlink on the current selection, or displays a dialog box enabling the user to specify a URL to insert as a hyperlink on the current selection.


 

Cut

Copies the current selection to the clipboard and then deletes it.


 

Delete

Deletes the current selection.


 

DirLTR

Not currently supported.


 

DirRTL

Not currently supported.


 

EditMode

Not currently supported.


 

FontName

Sets or retrieves the font for the current selection.


 

FontSize

Sets or retrieves the font size for the current selection.


 

ForeColor

Sets or retrieves the foreground (text) color of the current selection.


 

FormatBlock

Sets the current block format tag.


 

Indent

Increases the indent of the selected text by one indentation increment.


 

InlineDirLTR

Not currently supported.


 

InlineDirRTL

Not currently supported.


 

InsertButton

Overwrites a button control on the text selection.


 

InsertFieldset

Overwrites a box on the text selection.


 

InsertHorizontalRule

Overwrites a horizontal line on the text selection.


 

InsertIFrame

Overwrites an inline frame on the text selection.


 

InsertImage

Overwrites an image on the text selection.


 

InsertInputButton

Overwrites a button control on the text selection.


 

InsertInputCheckbox

Overwrites a check box control on the text selection.


 

InsertInputFileUpload

Overwrites a file upload control on the text selection.


 

InsertInputHidden

Inserts a hidden control on the text selection.


 

InsertInputImage

Overwrites an image control on the text selection.


 

InsertInputPassword

Overwrites a password control on the text selection.


 

InsertInputRadio

Overwrites a radio control on the text selection.


 

InsertInputReset

Overwrites a reset control on the text selection.


 

InsertInputSubmit

Overwrites a submit control on the text selection.


 

InsertInputText

Overwrites a text control on the text selection.


 

InsertMarquee

Overwrites an empty marquee on the text selection.


 

InsertOrderedList

Toggles the text selection between an ordered list and a normal format block.


 

InsertParagraph

Overwrites a line break on the text selection.


 

InsertSelectDropdown

Overwrites a drop-down selection control on the text selection.


 

InsertSelectListbox

Overwrites a list box selection control on the text selection.


 

InsertTextArea

Overwrites a multiline text input control on the text selection.


 

InsertUnorderedList

Toggles the text selection between an ordered list and a normal format block.


 

Italic

Toggles the current selection between italic and nonitalic.


 

JustifyCenter

Centers the format block in which the current selection is located.


 

JustifyFull

Not currently supported.


 

JustifyLeft

Left-justifies the format block in which the current selection is located.


 

JustifyNone

Not currently supported.


 

JustifyRight

Right-justifies the format block in which the current selection is located.


 

LiveResize

Causes the MSHTML Editor to update an element's appearance continuously during a resizing or moving operation, rather than updating only at the completion of the move or resize.


 

MultipleSelection

Allows for the selection of more than one site selectable element at a time when the user holds down the SHIFT or CTRL keys.


 

Open

Not currently supported.


 

Outdent

Decreases by one increment the indentation of the format block in which the current selection is located.


 

OverWrite

Toggles the text-entry mode between insert and overwrite.


 

Paste

Overwrites the contents of the clipboard on the current selection.


 

PlayImage

Not currently supported.


 

Print

Opens the print dialog box so the user can print the current page.


 

Redo

Not currently supported.


 

Refresh

Refreshes the current document.


 

RemoveFormat

Removes the formatting tags from the current selection.


 

RemoveParaFormat

Not currently supported.


 

SaveAs

Saves the current Web page to a file.


 

SelectAll

Selects the entire document.


 

SizeToControl

Not currently supported.


 

SizeToControlHeight

Not currently supported.


 

SizeToControlWidth

Not currently supported.


 

Stop

Not currently supported.


 

StopImage

Not currently supported.


 

StrikeThrough

Not currently supported.


 

Subscript

Not currently supported.


 

Superscript

Not currently supported.


 

UnBookmark

Removes any bookmark from the current selection.


 

Underline

Toggles the current selection between underlined and not underlined.


 

Undo

Not currently supported.


 

Unlink

Removes any hyperlink from the current selection.


 

Unselect

Clears the current selection.


 

Reference from : http://msdn2.microsoft.com/en-us/library/ms533049(VS.85).aspx