Showing posts with label SharePoint Error And Resolution. Show all posts
Showing posts with label SharePoint Error And Resolution. Show all posts

Error : Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

Hello All

I have created list in my SharePoint Site. And my requirement is to get data from SharePoint Site.

Here is my Simple code:

using (SPSite site = new SPSite(siteurl))
{
using (SPWeb web = site.OpenWeb())
{
SPList lstUsers = web.Lists["SiteUsers"];
SPQuery Qry = new SPQuery();
Qry.Query = "<Where><Eq><FieldRef Name='IsActive' /><Value Type='Boolean'>0</Value></Eq></Where>";
DataTable dtUsers = lstUsers.GetItems(Qry).GetDataTable();
if (dtUsers != null && dtUsers.Rows.Count > 0)
{
//Bind the data
}
}
}
}


When I am trying to get data from the SharePoint List, I got this Error Message:

Error : ‘Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack’

After doing some research I found solution. I need to change the Authentication mode in configuration file from ‘Form’ to ‘Windows’.

Solution : <authentication mode="Forms"> replace with <authentication mode="Windows">

That’s it, Problem Solved.
It works fine for me, Hope it helps

Error : Code blocks are not allowed in this file

Hi All

I also faced such error in one of SharePoint site when I add one .aspx page, which contains some inline script and code. But at last I found solution for this error. When you add inline script or code in you .aspx page, it works fine as long as the page remain uncustomized in ghosted state. But as soon as you modify any aspect of this page with the SharePoint designer, it turns into unghosted state, WSS then begin to use safe mode to process it. So you just need to add following line of code within the SharePoint section of the web.config file.

<SharePoint>
<SafeMode…>
<PageParserPaths>
<PageParserPath VirtualPath=”Your Page Path” IncludeSubFolder=”true” CompilationMode=”Always” AllowServerSideScript=”true” />
</PageParserPath>
</SafeMode>
</SharePoint>

This Error is very common when you are going add site pages within SharePoint site and make some modification in page with SharePoint Designer.

Hope it will work for you guys. It seems work fine for me.