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.

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


 

}

}