Friday 28 December 2012

SharePoint - Cannot peform this operation. The file is no longer checked our or has been deleted

Problem:

Recently I faced a problem, that in SharePoint Designer (2010), one of my file I checked out and then I checked Inn. Again when I opened my SharePoint site in Designer, it was showing the same file as checked inn. So I thought I might have forgot to check Inn. I again tried to check Inn, but it promt me an error message : 
               " Cannot peform this operation. The file is no longer checked our or has been deleted  "

Solution:

It is because of the cache being mantained with respect to user websites and application data.
What you have to do is, go to following locations :
  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
And clear all the content inside both folders. and try again, you are done!!

Hope this help!!

Saturday 22 December 2012

The Report Server "http://localhost//ReportServer" is invalid

Problem:

Recently I faced a problem while installing with ReportingInstaller for Microsfot Commerece Server 2009 R2,  parameters like data warehouse server and Report Server url were correct but when I clicked "Test Connection" I got error message that :

"The Reporting Server "http://localhost/ReportServer" is invalid."

Solution: 

I googled for it, but didn't find any solution. What I did , I tested the url I was trying to hit in browser, then it returned me error that :

 "The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing"

Then I googled for it and found that we have to add user in the ReportServer configuration, and by following command you can add user :

rsconfig -c -s < SQLSERVERNAME > -d reportserver -a Windows -u < MYDOMAIN\MYACCOUNT > -p < PASSWORD >orrsconfig -c -m < REMOTECOMPUTERNAME > -s < SQLSERVERNAME > -d reportserver -a SQL -u SA -p < SAPASSWORD >
It worked for me nicely!!

Hope it help someone else..!! :-)


Friday 7 December 2012

Javascript or Css disappears in Content Editor Webpart - CEWP

Problem:

Recenlty I faced a problem that I was writing some html along with javascript tag with some code in the CONTENT EDITOR WEBPART (CEWP). As soon as I save the page, all the tags of javascript disppeared or removed from CEWP. I googled, but did not find any solution.

Solution:

What I did, encapsulated the script and html within "CDATA" section, actually sharepoint 2010, it was removing all such script tags from the CEWP becasuse of secrutiy purpose, it removes all the script which could threaten or inject. Thus CDATA solved my problem.

Updated (Feb 18 2013) :
On my friend's request FAZ, am including an example to explain it littile bit more on this topic.

Sometimes you edit a page in sharepoint designer, and add javascript snippet in the page, on saving the page it prompt you a message that "unsafe code will removed...", and when the page is saved you will notice that the javascript snippet you just added is removed.
For Example:
1. Edit a page and add some javascript code snippet in the Content Editor Webpart and save.
 (Content Editor webpart is inserted using "Insert" tab in the SharePoint Designer, and then "Webpart" menu, and then select "Content Editor")
2. When you will save , it will prompt a message just shown in the figure below:

3. When you will click "Yes", you will notice that the javascript snipped you just added have been removed from the page.
So for that we have to keep our javsacirpt / CSS snippet in CDATA wrapping as shown below:


<script type="text/javascript"><![CDATA[
function Test()
{
alert("tested!");
}
]] </script>

Then it will not remove your snipped from the page.

Hope this help!!

Thursday 6 December 2012

Captcha not working when hosted in IIS

Problem:

Recently I faced a problem that captcha was working when I browse my page which contains Captcha , was working fine, but when I hosted site in IIS , captcha image was not appearing instead it was showing just cross mark when I browse page in IE.

Solution:

Finally I found its solution. If you check the path of captcha image by right click, take properties of the image which is appearing as red cross mark, it will show you what its actually trying to hit or show, in my case it was an aspx patch with name CaptchaImage.aspx?id={xxxxx}, something like this.

So what I did, in IIS, 
1. selected my application, and
2. then chose "Handler Mappings", 
3. then clicked "Add Managed Handler" under "Action",

4. Request Path : Type the target url path of your captcha, as in my case mentioned above as page CaptchaImage.aspx,
in some cases it could be with different extension like CaptchaImage.axd, to confirm this, check your web.config , you will find this path in the tag you added for captch to work.
5. Type :  choose your dll or assembly from dropdown, if it is  not appearing , then you will have to add that assembly or dll as reference in your application or project from VS.
6. Name:  Type  any name for the hanlder, like CaptchaHandlerMapping . and click OK.




Now again browse page having captcha , it must work!!.
Hope this help.


Sunday 2 December 2012

System.Security.SecurityException was unhandled by user code - InfoPath 2010

Problem:

Sometimes working with InfoPath , in my case its InfoPath - 2010, come across a problem of security exception mentioned below :

System.Security.SecurityException was unhandled by user code
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx' failed

This exception arises when we are using some code snippet to communicate with SharePoint in any way. 

Plus would like to mention that when we use any "Manage Data Connection" , and preview our InfoPath form, it usually prompt a message :




Solution:

To solve this problem, you have to switch your InfoPath - 2010 form to Full Trust.
To do that, click "File" , then from menu choose "Info" and then "Form Options", and then uncheck "Automatically determine security level", by default its checked, and it will enable 3 radio buttons below this.
You have to choose "full trust", click OK. 

Now both the above mentioned warnings and exception should not occur.


Column or table name conflicting with keyword in SQL Server

Problem:

Sometimes we face a problem in SQL Server that column name or table name is same as one of the keyword of SQL server, like Session, Description etc. which might cause some syntax errors.

For example:
Select  Description  From Session

It will show you highlighted Description and Session as if it is treating both as keyword. and your whole statement will become blue :-P.

Solution:

To differentiate keyword and names of your column and table, you can use squar brackets around the column or table name. like

Select  [Description]  From [Session]

Hope this help someone.!!

Test Email without sending Email to User - C# / C-Sharp - DotNet

Sometimes we may want to test email functionality without sending email to actual user. Email will be saved locally so that we can verify ...