Wednesday, August 5, 2009

How to know the version of the SharePoint you are using

Go to Control Panel -> Add and Remove Programs.
OR, Go to (Windows) Start>Run>
Type appwiz.cpl


Select the product (sharepoint server) and then click: Click here for support.

Or: Under Tasks, Click "View Installed Updates"
Doesn't it answer your querry? :) Window must have popped up and said about your current SharePoint version.

Saturday, July 11, 2009

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level, More than one Web.config

You may get this error when trying to browse an asp.net application.

The debug information shows that "This error can be caused by a virtual directory not being configured as an application in IIS."

However, this error occurs primarily out of 2 scenarios.

1. When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application.
However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and
may get the above error. The debug information you get as mentioned above, is applicable to this scenario.

To resolve it, Right Click on the virtual directory - select properties and then click on "Create" next to the "Application" Label and the textbox. It will
automatically create the "application" using the virtual directory's name. Now the application can be accessed.

2. When you have sub-directories in your application, you can have web.config file for the sub-directory. However, there are certain properties which cannot
be set in the web.config of the sub-directory such as authentication, session state (you may see that the error message shows the line number where the
authentication or sessionstate is declared in the web.config of the sub-directory). The reason is, these settings cannot be overridden at the sub-directory level
unless the sub-directory is also configured as an application (as mentioned in the above point).

Mostly we have the practice of adding web.config in the sub-directory if we want to protect access to the sub-directory files (say, the directory is admin and we
wish to protect the admin pages from unathorized users).

But actually, this can be achieved in the web.config at the application's root level itself, by specifing the location path tags and authorization, as follows:-

However, if you wish to have a web.config at the sub-directory level and protect the sub-directory, you can just specify the Authorization mode as follows:-

Thus you can protect the sub-directory from unauthorized access.

Thursday, June 18, 2009

Menu control (Asp.net 2.0) is not displaying properly in Google chrome and IE8 (Beta).

Though the Asp.net 2.0 menu control was displaying fine in IE 6 and Mozilla, There were issues with mouse hover styles and alignment in Google Chrome and IE 8. I was scratching my head over and over for long.

Could find a solution to tackle this issue. This is really interesting.

The C# version of the solution is as follows:

( If you got a master page for the application / website, write this snippet in it's PreInit event )

protected void Page_PreInit(object sender, EventArgs e)
{
if (!IsPostBack)
{
if ((Request.UserAgent.IndexOf("AppleWebKit") > 0 ) || (Request.UserAgent.IndexOf("Unknown") > 0 ) || ( Request.UserAgent.IndexOf("Chrome") > 0 ))
{
Request.Browser.Adapters.Clear();
}
}
}

Happy hours ! It works for Chrome. Im trying for IE 8. Let me know if some one can give some ideas.

Tuesday, June 9, 2009

Export Excel Data to SQL Server Database

Stored procedure for Exporting data from Excel Sheet to SQL Server Table.

CREATE TABLE [dbo].[MyAddressTable] (
[FirstName] VARCHAR(20),
[LastName] VARCHAR(20),
[ZIP] VARCHAR(10)
)
GO

SELECT * FROM [MyTestDB].[dbo].[MyAddressTable]

INSERT INTO [MyTestDB].[dbo].[MyAddressTable] ( [FirstName], [LastName], [ZIP] )
SELECT [FirstName], [LastName], [ZIP]
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=E:\sabin\Try.xls;IMEX=1',
'SELECT * FROM [Sheet1$]')

It does not need to have excel to be installed in the Server machine where SQL Server is installed. All you need to have is a file of .xls in the server.

OPENROWSET featire to be enabled through SQL Server Surface Area Configuration.
Start > SQL Server 2005 > Configuration Tools > Surface Area Configuration

Click Surface Area Configuration for Features
Click on Database Engine and Check the Enable OPENROWSET and OPENDATA..

Done !

Monday, May 11, 2009

Could not initialize Photoshop because the file is locked. Use the 'Properties' command in the Windows explorer

On MS Windows XP Professional (SP1) when a limited user tries to start
Adobe Photoshop CS v.8.0 he gets the following error message:
"Could not initialize Photoshop because the file is locked.
Use the 'Properties' command in the Windows Explorer to unlock the file."

It seems that the cause of the problem is the location for Photoshop
scratch file (a kind of temporary file. In Photoshop CS you can set the
volumes (i.e. partitions) for scratch files in the following way:
Edit -> Preferences -> Plug-Ins & Scratch Disks
You can define up to four scratch volumes.

Here is how the problem happened in my case:
The Photoshop CS v.8.0 was installed by an administrator on the system
partition, i.e. on the partition where the Windows folder is located
(also the "Documents and Settings" and "Program Files" folders) -- by
default this is the C: partition.
When the Photoshop was first started by a limited user account (who
was not member of the local administrators group) he got the following
message:
"You currently have Adobe Photoshop's primary Scratch and Windows'
primary paging file on the same volume, which can result in reduced
performance. It is recommended that you set Adobe Photoshop's primary
Scratch volume to be on a different volume, preferably on a different
physical drive."

Following that recommendation the user set the Photoshop first scratch
volume to D:\ (this was the second hard disk on his PC). But after
closing Photoshop he was unable to start it again because of the
error, "Could not initialize Photoshop because the file is locked ..."

The problem is that the Photoshop is unable to create the scratch file
on the D: partition as in Windows XP limited users don't have right by
default to create files on the root of a partition (D:\).

On the other hand if the first scratch volume is set to "Startup",
then Photoshop opens the scratch file on the partition where it was
installed, which is here the system partition. More precisely, in that
case Photoshop opens the scratch file in the temporary folder pointed
by the TEMP and TMP Windows environment variables. By default, these
variables have the value, "%USERPROFILE%\Local Settings\Temp" where
%USERPROFILE% is another Windows environment variable that points to
the user profile folder, e.g. "C:\Documents and %Settings\user_name".

Conclusion: if you want to have the Photoshop scratch file on a
partition which is not the system partition, you also have to have
right to write files to the root of that partition.

If you are not allowed to have that right, then as a workaround you
can restore the Photoshop default user preferences by renaming or
deleting the "Adobe Photoshop CS Prefs.psp" file in your user profile
folder -- more precisely in the folder,
%USERPROFILE%\Application Data\Adobe\Photoshop\8.0\Adobe Photoshop CS Settings\
(you can copy the path and open it in the Windows Explorer).

In my opinion this is a bug in Photoshop. When user changes the
scratch drives, Photoshop should check if it is able to open a file on
the corresponding location before allowing the change. Also, if it is
unable to open the scratch file afterwards, it should try to open the
file at another location.
According to some previous articles in the news groups, this bug also
existed in some previous versions of Photoshop and it is strange that
it hasn't been corrected yet.

Tuesday, May 5, 2009

The permissions granted to user (IUSR) are insufficient for performing this operation." when trying to view Report Site

The permissions granted to user (IUSR) are insufficient for performing this operation." when trying to view Report Site.

The permissions granted to user are insufficient for performing this operation. (rsAccessDenied)

Go to My Computer, Right click and get the User Management by clicking Manage. See the Users in the Machine. Right Click on the IUSR_MACHINENAME and view the Properties. Get the “Member Of” tab and add “Administrators” group in the Members List.

Now browse http://Server Name or IP/Reports/ (Report Browsers)
http://Server Name or IP/ReportServer (Report Manager)

Works fine !

Microsoft.ReportingServices.RsProxy.AccessDeniedException

I Came across this error message (Exception of type 'Microsoft.ReportingServices.RsProxy.AccessDeniedException' was thrown. ) today whilst installing SQL Server 2005 Reporting Services on a windows 2003 server

thought i'd share the answer for anybody else search as there wasn't much on the Internet for it.

To fix the issue I followed these steps :-

Go to Report Manager
Select Site Settings from the top right menu
Select Configure item-level role definitions
Select Content Manager
make sure all the tick boxes are ticked
For myself the Manage / View models tickboxes were not ticked and this fixed the issue

Hope this helps you out.