This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Friday, December 18, 2009

SQL REPLACE

Update tbl_mytbl
Set [Content]=convert(ntext,REPLACE(convert(varchar(8000),[Content]),'ddd/pdf/','Documents/'))
where Content LIKE '%ddd/pdf/%'

REPLACE for nTEXT datatype

Update mytable
Set [Content]= cast(replace(cast([Content] as nvarchar(max)),'myfolder/pdf/','Documents/') as ntext)
where Content LIKE '%myfolder/pdf/%'

Wednesday, December 9, 2009

String or binary data would be truncated.

I was getting this error when i was trying to delete some rows from the table.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=119861

Tuesday, November 24, 2009

Cannot Find SharePoint Site or SharePoint Server Instance

This problem can occur when the workflow deployment process cannot open the SharePoint site.

Error Messages
  • SharePoint Server not available.

  • Cannot find a SharePoint server instance.

  • Cannot find the specified SharePoint site: <site URL>.

Resolution
  • Ensure that SharePoint Server is running.

  • In the Properties window, ensure that the site specified in the Target Site field is a valid SharePoint site.

  • Examine the SharePoint diagnostic log files. The default location of these log files is drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS. If you cannot find the log files at this location, refer to the diagnostic logging settings in the SharePoint Central Administration Tool. For more information, see the documentation for Office SharePoint Server 2007.

 

http://msdn.microsoft.com/en-us/library/ee231594(VS.100).aspx

Tuesday, November 17, 2009

Free SMTP server

Windows 7 does not provide an SMTP server service so we have to use a free SMTP server:

http://www.softstack.com/freesmtp.html

Friday, November 13, 2009

Service Unavailable HTTP Error 503. The service is unavailable.

Maybe you have changed your windows account password. Reset the password at the Application pool identity level

Wednesday, November 11, 2009

MY SQL connection string for .NET

driver={mysql odbc 3.51 driver}; uid=userid; pwd =test server=localhost; option=16834; database=ourdbname;

Saturday, November 7, 2009

Grant Execute permissions to an sql user

use this command:


GRANT EXECUTE TO username

Wednesday, November 4, 2009

Handling Lookup columns in CAML queries

if query returns all the records instead of only filtered ones:
try to do this: remove the <query></query> tags from C#

CAML Query Builder

http://www.u2u.be/Res/Tools/CamlQueryBuilder.aspx

User control web part

http://www.reflectionit.nl/SmartPart.aspx

CAML Queries to retrieve records from a sharepoint list

http://sharepointmagazine.net/technical/development/writing-caml-queries-for-retrieving-list-items-from-a-sharepoint-list

Retrieving list items from a Sharepoint list

http://weblogs.asp.net/gunnarpeipman/archive/2008/09/27/sharepoint-for-developers-3-2-hands-on-getting-list-items.aspx

Install AJAX Control Toolkit in Visual Studio 2008

http://www.aspnettutorials.com/tutorials/ajax/installing-ajax-toolkit-2008.aspx

SSH to a UNIX machine

http://math.asu.edu/support/doc/ssh/ssh.html

SharePoint SmartPart

http://www.codeplex.com/Wikipage?ProjectName=smartpart

Joomla for Beginners

http://docs.joomla.org/Beginners

Access Joomla files - Tutorial

· Access your jumpbox site admin view (usually https://youripaddress:3000/) and go to SSH/SFTP

 j1
· After enabling; open an FTP client e.g. Core FTP Lite; set it to SFTP and use your admin user and password; then give the IP of the jumpbox server

j2

· U can browse through the filesystem now

j3

Tuesday, October 20, 2009

Assign CSS on the basis of browser

<link type="text/css" rel="stylesheet" href="css/white-master.css" media="screen, projection" />
<link type="text/css" rel="stylesheet" href="css/jquery.jcarousel.css" media="screen, projection" />
<!--[if IE]>
<style>
#browser-controls li.txturl input
{
width: 340px; /*367 *..340/
/* height: 20px; */
height:24px;
padding:0px;
/* list-style: none; */
}
</style>
<![ENDIF]-->

you can also use the link tag instead of the inline style tag

Javascript to assign CSS on the basis of browser

<script language="JavaScript"><br /><!-- var browser = ''; var version = ''; var entrance = ''; var cond = ''; // BROWSER? if (browser == ''){ if (navigator.appName.indexOf('Microsoft') != -1) browser = 'IE' else if (navigator.appName.indexOf('Netscape') != -1) browser = 'Netscape' else browser = 'IE'; } if (version == ''){ version= navigator.appVersion; paren = version.indexOf('('); whole_version = navigator.appVersion.substring(0,paren-1); version = parseInt(whole_version); } //if (browser == 'IE' && version <= 6) document.write('<'+'link rel="stylesheet" href="oldstyle_ie.css" />');<br />if (browser == 'IE' && version > 6) document.write('<'+'link rel="stylesheet" href="css/ie7.css" />');<br />else document.write('<'+'link rel="stylesheet" href="css/white-master.css" media="screen, projection" />');<br />//if (browser == 'Netscape' && version >= 2.02) document.write('<'+'link rel="stylesheet" href=" style.css" />');<br />// --><br /></script>

Wednesday, October 7, 2009

Create a random guid

System.Guid.NewGuid().ToString()

Tuesday, October 6, 2009

Web based Virtual Machine

G.ho.st Virtual Computer

Monday, October 5, 2009

Google API for Dot Net

http://code.google.com/p/google-api-for-dotnet/


 // Search 32 results of keyword : "Google APIs for .NET"
GwebSearchClient client = new GwebSearchClient(/* Enter the URL of your site here */);
IList<IWebResult> results = client.Search("Google API for .NET", 32);
foreach(IWebResult result in results)
{
Console.WriteLine("[{0}] {1} => {2}", result.Title, result.Content, result.Url);
}

The above not working in vb.net so did the following:
    Public Sub GetGoogleResults()
Dim client As New GwebSearchClient("/* Enter the URL of your site here */") Dim results As IList(Of IWebResult) results = client.Search(txtQuery.Text, 50, Nothing, Nothing, SafeLevel.GetDefault(), Language.GetDefault(), DuplicateFilter.GetDefault()) For Each result As Google.API.Search.IWebResult In results Literal1.Text = Literal1.Text + String.Format("<h3>[{0}]</h3> {1}<br> " + "<a href=' {2} ' target='blank'>{2}</a><BR>", result.Title, result.Content, result.Url) Next End Sub

Sunday, October 4, 2009

Simple ViewState Property

Protected Property bvin() As String
Get
If (Not ViewState("bvin") Is Nothing) Then
Return ViewState("bvin")
End If
Return ""
End Get
Set(ByVal Value As String)
ViewState("bvin") = Value
End Set
End Property

----------------------------------------------
public string SORTBy
{
get
{
if (ViewState["SORTBy"] != null)
{
return SafeCast.ToString(ViewState["SORTBy"]);
}
return "";
}
set
{
ViewState["SORTBy"] = value;
}
}

Add Wikipedia Search Engine to Google Chrome

http://www.chromeplugins.org/google/chrome-tips-tricks/how-add-wikipedia-search-engine-google-chrome-94.html

Friday, October 2, 2009

Monday, September 28, 2009

Anonymous access in server 2008 IIS

goto Default Website -> Authentication -> Anonymous Authentication (set enable/disable)

System.DirectoryServices.DirectoryServicesCOMException: Logon failure: unknown user name or bad password.

http://stackoverflow.com/questions/400872/c-active-directory-check-username-password

Resolved my issue by using "Imports System.DirectoryServices.AccountManagement"
Project was working well in XP but not in Windows 7

Replaced:

Dim domainEntry As DirectoryServices.DirectoryEntry
Dim searcher As DirectoryServices.DirectorySearcher
Dim results As DirectoryServices.SearchResultCollection
Dim domainLogin As String
Dim fullName As String

domainLogin = User.Identity.Name

'Strip off domain prefix
domainLogin = domainLogin.Substring(domainLogin.IndexOf("\") + 1, domainLogin.Length - domainLogin.IndexOf("\") - 1)

domainEntry = New DirectoryServices.DirectoryEntry("LDAP://domainname.com", "domainname\username", "Password")
searcher = New DirectoryServices.DirectorySearcher(domainEntry, "(SAMAccountname=" + domainLogin + ")")
results = searcher.FindAll()


with:

Dim domainEntry As DirectoryServices.DirectoryEntry
Dim searcher As DirectoryServices.DirectorySearcher
Dim results As DirectoryServices.SearchResultCollection
Dim domainLogin As String
Dim fullName As String

domainLogin = User.Identity.Name

'Strip off domain prefix
domainLogin = domainLogin.Substring(domainLogin.IndexOf("\") + 1, domainLogin.Length - domainLogin.IndexOf("\") - 1)
Dim context As PrincipalContext = New PrincipalContext(ContextType.Domain)
Dim foundUser As UserPrincipal = UserPrincipal.FindByIdentity(context, "username")
domainEntry = CType(foundUser.GetUnderlyingObject(), DirectoryEntry)

searcher = New DirectoryServices.DirectorySearcher(domainEntry, "(SAMAccountname=" + domainLogin + ")")
results = searcher.FindAll()

Login failed for user ''. The user is not associated with a trusted SQL Server connection

http://support.microsoft.com/kb/555332

Thursday, September 17, 2009

Monday, September 7, 2009

Blog Module with DNN 5.1.2

Blog Module and some other modules are not available with DNN 5.1.2 because it is a new release; so I would suggest people who require more modules to use DNN 4.9

Sunday, August 2, 2009

Check if QueryString Exists

http://bytes.com/groups/net-asp/340313-querystring-exists

If (Request("test") = Nothing) Then
Response.Write("QueryString does not exist!")
Else
End If

Thursday, July 30, 2009

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID{61738644-F196-11D0-995

http://community.spiceworks.com/windows_event/show/84-dcom-10016

My issue was related to an IIS service

following is the resolution from the above link:

1. Open the registry and go to "HKEY_CLASSES_ROOT\CLSID\{} to find out friendly name of this component. In my case, this is "Machine Debug Manager” (CLSID: 0C0A3666-30C9-11D0-8F20-00805F2CD064).

2. Go to Component Services via Start -> Control Panel -> Administrative Tools -> Components Services. Expand the Component Services branch then expand "Computers", "My Computer", and "DCOM Config". Right-click on "Machine Debug Manager" (or whatever your CLSID represents) and choose Properties. Click on the Security tab and under “Launch and Activation Permissions” select "Use Default". Click OK, close the Component Services window. The error should disappear now.

Using Image as a submit button

http://www.webdevelopersnotes.com/tips/html/using_an_image_as_a_submit_button.php3

Friday, July 24, 2009

Use multiple columns in a databound drop down list

http://aspnetgoodies.wordpress.com/category/multiple-columns-in-data-bound-drop-down-list/

I got this idea from the above link; but my problem was that i had to get an aggregate function value and a normal column value and show them in my list e.g.

New (0)
Pending (13)
Old (3)
Discarded (50)

the above are the status types (New, Pending, Old, Discarded) and then (xyz) is the total number of applications which lie in this status. so basically two queries are used. One for selecting the application statuses, and the other from selecting the count of applications in the respective status.

So this is what I did:

Created a UDF to get the counts:

CREATE FUNCTION GetCountsForStatusType
(
-- Add the parameters for the function here
@statusTypeID Int
)
RETURNS int
BEGIN
Declare @myCountVar Int
select @myCountVar= count(appStatusId) from tblApplications where appStatusId = @statusTypeID and (AppProvince <> 'Ontario' or ( appStatusId =@statusTypeID and AppProvince = 'Ontario' and appCreateDate < '6/30/2009'))
Return @myCountVar
END

Then; I created a View:

Create View [dbo].[statusTypesWithCount]
As
SELECT statusTypeId,
statusTypeName + ' (' + convert(varchar(80),dbo.GetCountsForStatusType(statusTypeId)) + ')' AS statusTypeName
FROM dbo.tbAppStatusTypes

Then finally; I created a stored procedure with this query:

select * from statusTypesWithCount order by statusTypeId asc

and then bound the dropdownlist with this datasource; and chose DataTextField="statusTypeName"

There you go :)

ASP Include Files

http://www.w3schools.com/asp/asp_incfiles.asp

Difference b/w include Virtual and include file

ASProxy

http://www.codeproject.com/KB/aspnet/asproxy.aspx

Get data from DataReader using column name

drName("columnName")

but research says this is very expensive so try to use GetOrdinal method of the datareader and then get the index to retrieve the data

Set Page Title dynamically

http://aspnet.4guysfromrolla.com/articles/051006-1.aspx

Invalid attempt to read when no data is present

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/076fdaa2-6a17-4ce7-87bf-0d9340cfc61e

Use datareaderName.Read()

There is already an open DataReader associated with this Command which must be closed first

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/78d3989a-8975-4930-998d-1eb907966f57

Sunday, July 19, 2009

'System.Array' does not contain a definition for 'Contains' ...

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/d20d585c-de6f-4fce-bb62-8a4ff2321657

You have to Add Linq references.

using System.Linq; and (possibly):
using System.Data.Linq; // not sure about the latter though.

Wednesday, July 15, 2009

Accessing web.config key using javascript

I was using this way to get web.config key value in javascript:


but i got this error:

Too many characters in character literal

because my string was very long. So I used this way instead:


Another way:



Add javascript & HTML in Blogger posts

http://share-useful-links.blogspot.com

Use the HTML Parser to convert your code, and then post in blogger :)

Access function defined in parent from inside an Iframe

this is the function defined in a.aspx
this page has an iframe which will call this method

<script type="text/javascript">
var myIframeUrl;
function modifyVar(val) {
myIframeUrl = val;
}
</script>
-----------
in the iframe use this statement:
<script type='text/javascript'>parent.modifyVar('" + requestURL + "');</script>"

Get form hidden variable value from outside the IFrame

An iframe contains a form with a hidden variable (input type =" hidden">and I needed to access this hidden variable in the parent page which contains the Iframe, here is how I did it:


but it didnt work for every website, on some it gave the javascript permission denied error:

Get Current URL of an Iframe

http://forums.devarticles.com/programming-tools-11/how-do-i-get-the-url-of-an-iframe-11460.html - Useful for me in some cases

Javascript string functions

http://www.w3schools.com/jsref/jsref_obj_string.asp

Monday, July 13, 2009

Access Session variables inside an asp.net handler

http://www.codedigest.com/CodeDigest/23-Accessing-Session-Variable-in-HttpHandler-in-ASP-Net.aspx

Failed to access IIS metabase

http://geekswithblogs.net/narent/archive/2007/03/23/109573.aspx

Create a web application using SharePoint Designer

http://blogs.technet.com/brenclarke/archive/2009/04/14/creating-a-quiz-web-application-using-sharepoint-designer.aspx

Read XLS and XLSX files using .net

string filenames = path.Substring(path.LastIndexOf("\\") + 1);
string ext = filenames.Substring(filenames.LastIndexOf(".") + 1);
if (ext == "xls" || ext == "xlsx")
{

String strExcelConn = "Provider=Microsoft.ACE.OLEDB.12.0;"
+ "Data Source=" + path
+ ";Extended Properties='Excel 8.0;HDR=Yes'";
OleDbConnection connExcel = new OleDbConnection(strExcelConn);
OleDbCommand cmdExcel = new OleDbCommand();
cmdExcel.Connection = connExcel;
connExcel.Open();
System.Data.DataTable dtExcelSchema;
dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

System.Data.DataSet ds = new System.Data.DataSet();
string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();
cmdExcel.CommandText = "SELECT Top 10 * From [" + SheetName + "]";
System.Data.OleDb.OleDbDataAdapter da = new OleDbDataAdapter(cmdExcel);
System.Data.OleDb.OleDbDataReader dr = cmdExcel.ExecuteReader();
}

Sunday, July 5, 2009

Wednesday, July 1, 2009

Hidden div not displaying in Firefox (display:none)

Don't use:

var obj=document.getElementById('divname');
if (obj.style.display=='none'){obj.style.display="";}

(the above works only in IE, not in firefox)
Instead; use:

document.getElementById('divname').style.display="";
(the above works both in firefox n IE)

Post html form to aspx page

http://stackoverflow.com/questions/209301/how-to-post-a-form-from-html-to-aspx-page

dont forget the "name" attribute :)

Monday, June 29, 2009

Sliding divs overlapping other divs in IE 7

Change the following doctype

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

TO

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

(put angular brackets---i have removed them to disallow interpretation of HTML)

Show/Hide divs using javascript

http://www.webmasterworld.com/forum91/441.htm

Create sliding divs

http://www.dhtmlgoodies.com/index.html?whichScript=show_hide_content_slide

Wednesday, June 10, 2009

Gnerate lorem ipsum text


You can also type “=lorem()” into Word to generate Lorem Ipsum text.

Syntax:
=lorem(paragraphs,sentences)

Example:
=lorem(6,20)

Or if you want random actual words from Word help files, you can use “=rand()” with the same optional (paragraphs, sentances) syntax.

Turn Option Explicit off for the whole project

http://forums.asp.net/p/1034260/1425845.aspx#1425845

Delete a google site

http://www.google.com/support/sites/bin/answer.py?answer=90598&ctx=sibling

Advanced Discussion Board for SharePoint

http://weblogs.asp.net/soever/archive/2005/03/04/385523.aspx

.NET Framework and FTPS

I have been trying for many days to set up a connection with an FTPS server but was not able to connect and retrieve even just a list of files. I wanted to achieve it by simply using the FTPWebRequest already available in .NET framework.

I tried the following link and many others:

http://blogs.msdn.com/adarshk/archive/2005/04/22/410925.aspx


After an effort of 2-3 days, however, I came to know that the .NET framework 2.0 till now supports only EXPLICIT FTP over SSL and not Implicit connection (which is usually established above port 990)


http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/491341d3-0dd6-4c60-94c9-ca4d4cf3450a/


http://www.developmentnow.com/g/46_2006_5_0_0_755554/implicit-ftp--SSL-problem.htm


Turned out I could not do this without an external component involved. I tested the component available here and was able to connect to my FTP and didnt even require to verify the client certificate:


http://www.rebex.net/download/GetFileNotify.aspx?f=RebexTotalPack-Trial-1.0.3428.0-DotNet2.0.exe


A sample code of the function I used is:


Public Function GetFileByRebex()

Dim ftp As New Ftp()

ftp.Connect(ConfigurationManager.AppSettings("FTPUrl").ToString(), 990, Nothing, FtpSecurity.Implicit)

ftp.Login(ConfigurationManager.AppSettings("FTPUser"), ConfigurationManager.AppSettings("FTPPw"))

ftp.ChangeDirectory(ConfigurationManager.AppSettings("FTPWorkingDir"))

Dim fileNames As FtpList

fileNames = ftp.GetList()

Dim i As Integer

For i = 0 To (fileNames.Count - 1)

'Dim b As String

'b = fileNames.Item(i).Modified.Date.ToString()

If (fileNames.Item(i).Modified.Date.Equals(Today.Date)) Then

'Download file

todaysFileName = Now

todaysFileName = todaysFileName.Replace("/", "-")

todaysFileName = todaysFileName.Replace(":", "-")

ftp.GetFile(fileNames.Item(i).Name, Server.MapPath(ConfigurationManager.AppSettings("DownloadFolderName")) + todaysFileName + ".csv")

Exit For

End If

Next

End Function



Monday, June 8, 2009

Quick Convert ASP to ASP.NET

http://www.15seconds.com/News/News.asp?News_Id=550

Set up a DotNetNuke site

  1. Copy your site code to the new location
  2. Update the connection string in web.config
  3. Run the sql script on the server
  4. Grant EXECUTE permissions to ur database user on all the stored procedures
  5. update the application name in the aspnet_Applications table as well as the web.config applicationname attribute
  6. update the PortalAlias table in the database to set the new location
  7. browse your new site :)

Thursday, May 28, 2009

Elevating permissions/privileges in SharePoint

http://blogs.objectsharp.com/CS/blogs/jlee/archive/2009/01/06/elevating-privileges-in-sharepoint.aspx

Anonymous access in Sharepoint

http://sharepointlogics.com/2009/05/how-to-enable-anonymous-access-in.html

My problem (grayed out items in list anonymous users permissions) was solved by 
  • List settings > Advanced permissions > Allow read permissions to "All Items" instead of Only "their own" and then recheck the list permissions for anonymous users.

Add items to SharePoint list programmatically

http://blog.the-dargans.co.uk/2007/04/programmatically-adding-items-to.html

AllowUnsafeUpdates

http://hristopavlov.wordpress.com/2008/05/16/what-you-need-to-know-about-allowunsafeupdates/

AllowUnsafeUpdates

http://hristopavlov.wordpress.com/2008/05/16/what-you-need-to-know-about-allowunsafeupdates/

Tuesday, May 19, 2009

Watermark an Image using ASP.NET

http://www.eggheadcafe.com/community/aspnet/2/10080566/re.aspx

http://www.daniweb.com/forums/thread105229.html#

http://www.codeproject.com/KB/aspnet/httpImageHandler.aspx

http://www.dnzone.com/go?1397

http://community.devexpress.com/blogs/aspnet/archive/2009/03/20/add-watermark-to-asp-net-textbox.aspx

http://forums.asp.net/t/901961.aspx - MOST Useful for me

Search with filetype on Google

Write Query then put a space and type "filetype:ext" (without quotes)

e.g.

User Interface Design filetype:ppt

Will search against the keyword User Interface Design and will result only ppt files.

MVC Controller and Actions

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

MVC and ASP.NET Chart Controls

http://code-inside.de/blog-in/2008/11/27/howto-use-the-new-aspnet-chart-controls-with-aspnet-mvc/

http://www.codeproject.com/KB/aspnet/MvcChartControlFileResult.aspx

http://stackoverflow.com/questions/680448/asp-net-mvc-how-to-add-a-code-behind-page-to-a-partial-view

http://kinsey.no/blog/index.php/2008/11/13/microsoft-chart-controls-for-the-net-framework-rendering-using-a-httphandler/

http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx

http://www.myblogon.net/archive/2009/02/15/21.aspx

http://weblogs.asp.net/melvynharbour/archive/2008/11/25/combining-asp-net-mvc-and-asp-net-charting-controls.aspx

Get current url of the web page

Request.Url

http://dotnettipoftheday.org/tips/HttpRuntime.AppDomainAppVirtualPath.aspx

http://forums.asp.net/t/1383898.aspx


Tuesday, April 28, 2009

HTTP 405 - Resource not allowed

Resolved the issue by setting .NET Framework in IIS > Default Web site > Properties > .NET Framework

It wasn't set to any value earlier.

http://www.somacon.com/p126.php

Monday, April 27, 2009

Cannot register assembly "" - access denied. Please make sure you're running the application as administrator. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ba9d67b3-9d14-4a2a-ac5a-91441032ded4

Server object, ASP 0177 (0x80131509)

http://weblogs.asp.net/dneimke/archive/2004/01/31/65330.aspx

http://www.developmentnow.com/g/21_2006_8_0_0_807392/Error-when-calling-net-dll-com-in-ASP-page-by-setting-SoapDocumentMethodAttribute.htm

ASP PCase

http://psacake.com/web/func/pcase_function.htm

Unable to emit assembly: Referenced assembly '' does not have a strong name

Solution of the assigning the strong name to the third part DLL by using following command on visual studio command prompt.

E.g. Lets say the name of the third party DLL is myTest.dll. 
Step 1: Dis-assemble the assembly 
        ildasm myTest.dll /out:myTest.il


Step 2: Re-Assemble using your strong-name key 
        ilasm myTest.il /res:myTest.res /dll /key:myTest.snk /out:myTestSN.dll

This code work perfectly to assign strong name.

for verification you can use following command,
sn -vf myTestSN.dll

http://social.msdn.microsoft.com/forums/en-US/clr/thread/35930958-9775-4e56-bd38-0362d124ffc4/

Sunday, April 19, 2009

Apply minimum length validation using ASP.NET Validation Controls

Validation expression should be : /{numberOfCharacters}/

Comma indicates at least number of characters, no comma indicates exactly as much characters

<asp:RegularExpressionValidator
ID="revNewPW0"
runat="server"


ControlToValidate="textNewPassword"


ErrorMessage="Password should have at least 7 characters"


ValidationExpression="/{7,}/"></asp:RegularExpressionValidator>

Even better solution is here:

http://forums.asp.net/t/1130081.aspx

Monday, April 13, 2009

Central Administration > You are not authorized to view this page

The SSP Timer Job Distribution List Import Job was not run.
Reason: Logon failure: unknown user name or bad password

Go to Inetmgr > Application Pools > SharePoint Central Administration v3 > Properties > Identity > Predefined > Network Service.

Then restart IIS once :) n u r done

Monday, March 30, 2009

'Service Unavailable' Resolution

http://support.microsoft.com/kb/823552

http://guru-web.blogspot.com/2007/10/central-administration-site-service.html

http://articles.icscentral.com/Kb%20Articles/271/823552.aspx

http://www.digwin.com/view/sharepoint-service-unavailable-application-pool-crashes

http://njbblog.blogspot.com/2007/05/sharepoint-error-service-unavailable.html


 

In my case, this issue was fixed by

  • Right click on the application pool
  • Click Identity Tab
  • Choose "Configurable"
  • Set to a domain account & enter password / or any user with administrator rights (you can even use the same user with which you are currently logged in)
  • Restart IIS


 

Usually this error occurs when my domain account password has expired and I don't change it and keep on using the virtual machine (i.e. if my account password expires on 14th November, and I do not shut down my virtual machine or save its state on 12th November, then I run the virtual machine from the saved state on 15th November, so it creates a conflict between the logged in password and the actual password which has been changed on the active directory)

Wednesday, March 18, 2009

Read Write Lookup Fields in SharePoint lists

http://sridharu.blogspot.com/2008/03/how-to-readupdate-lookup-fields-in.html

SharePoint Lookup Column – Get Multiple Values

http://fuchangmiao.blogspot.com/2008/09/sharepoint-lookup-column-get-multiple.html

Simplify reading and writing field values of type SPFieldUser, SPFieldUrl and SPFieldLookup using extension methods

http://www.alexbruett.net/?tag=sharepoint

Get SharePoint list items programmatically

http://www.sharepointace.com/Blog/post/2007/12/Another-way-to-retrieve-SharePoint-List-Data---Use-built-in-functionality!.aspx

http://weblogs.asp.net/gunnarpeipman/archive/2008/09/27/sharepoint-for-developers-3-2-hands-on-getting-list-items.aspx

http://aidangarnish.net/blog/post/2007/08/Using-SharePoint-web-services-to-get-list-items.aspx

http://tomblog.insomniacminds.com/2008/01/28/sharepoint-internals-splistgetitems/

IIF Not Working

http://www.velocityreviews.com/forums/t103946-iif-not-working.html

Value does not fall within the expected range

http://blogs.msdn.com/johnlee/archive/2007/08/15/value-does-not-fall-within-the-expected-range-error.aspx

http://rehmangul.wordpress.com/2009/01/21/value-does-not-fall-within-the-expected-range-errors/

The Controls collection cannot be modified because the control contains code blocks.

The Controls collection cannot be modified because the control contains code blocks.

Change <%=xyz%> to <%#xyz%>

Programmatically load User control

http://blogs.vbcity.com/mcintyre/archive/2006/10/13/6389.aspx

Monday, March 16, 2009

SQL Server 2005 Express Error 3417

The file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf" is compressed but does not reside in a read-only database or filegroup. The file must be decompressed.

http://www.tomrafteryit.net/sql-server-2005-express-error-3417/

Tuesday, March 10, 2009

The entry 'ConnectionStringName' has already been added.

http://dev.communityserver.com/forums/t/478332.aspx

Try this:

    <connectionStrings>
        <remove name="ConnectionStringName" />
        <add name="ConnectionStringName" connectionString="server=(local);uid=;pwd=;Trusted_Connection=yes;database=communityserver" />
    </connectionStrings>