Membership SettingsPropertyNotFoundException after session was lost - c#

I am using membership and have created a custom profile that contains a property called FirstName. It works well except when the session/cookies are lost (I haven't figured out exactly which since it's pretty hard to reproduce). Then when I access any page of the site I get this exception:
[SettingsPropertyNotFoundException: The settings property 'FirstName' was not
found.]
System.Configuration.SettingsBase.GetPropertyValueByName(String
propertyName) +8757578
System.Configuration.SettingsBase.get_Item(String propertyName) +118
System.Web.Profile.ProfileBase.GetInternal(String propertyName) +49
System.Web.Profile.ProfileBase.get_Item(String propertyName) +129
WebFrontend.Security.SecurityHandler.get_FullName() +168
WebFrontend.Controls.LoginInfo.SetupLoginStatus() +15
System.Web.UI.Control.InitRecursive(Control namingContainer) +186
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +2098
Do you have any idea how I can stop this exception from being thrown? Also CustomErrors are ON for this site and it bypasses the error page, instead it shows the exception. I just want to prevent the users from seeing this ugly exception.

It sounds like you are attempting to access the users profile when they are no longer authenticated. I would reccomend that you consider implementing a Login View OR checking for authentication before accessing the users profile properties:
Login View: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.loginview.anonymoustemplate(v=vs.100).aspx
Check Authentication: http://msdn.microsoft.com/en-us/library/system.web.httprequest.isauthenticated(v=vs.90).aspx

Related

Recaptcha doesn't load dynamically in DNN module using Recaptcha.dll

I've a problem to load Google Recaptcha control when I try to assign Public & Private Keys dynamically in code behind. It works fine in simple ASP.Net website but It doesn't work when I integrate it in DNN module.
Error Message: reCAPTCHA needs to be configured with a public & private key.
Stack trace:
DotNetNuke.Services.Exceptions.PageLoadException: reCAPTCHA needs to be configured with a public & private key. ---> System.ApplicationException: reCAPTCHA needs to be configured with a public & private key. at Recaptcha.RecaptchaControl.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.UI.Modules.ModuleHost.InjectModuleContent(Control content) at DotNetNuke.UI.Modules.ModuleHost.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
Markup:
<googleCaptcha:RecaptchaControl ID="ctlRecaptcha" runat="server" />
Code-behind:
protected void Page_Load(object sender, EventArgs e)
{
ctlRecaptcha.PublicKey = "xyz";
ctlRecaptcha.PrivateKey = "abc";
}
I actually have a tutorial on DNNHero.com that teaches on creating a custom DNN registration with the Google Recaptcha. It includes a video and code project.
Looking at my code, I included the attributes for publickey and privatekey on my ascx, but with dummy values:
<googleCaptcha:RecaptchaControl ID="ctlRecaptcha" runat="server" PublicKey="your_public_key" PrivateKey="your_private_key"/>
I set the attribute values like you did in my Page_Load event. This worked for me. Give it a try and comment if it still throw the error.

Conflict between Sharepoint List Name and Document Library Name

I my share point site I have one List named "People List" and one Wiki Page Library named "People". I have created one visual webpart to display data from People list. I have created webpart property to read listname.The webpart property name for my visual webpart is "People". When I check whether list exists in my site using the following function it returns true:-
public static bool isListExists(SPWeb spWeb, string listName)
{
return spWeb.Lists.TryGetList(listName) != null;
}
But there is no List named "People" exists in my site. Only wiki page library named "People" exists. When I added my webpart in "MySite/People/default.aspx" page I got error.
Column 'Title' does not exist. It may have been deleted by another user.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Column 'Title' does not exist. It may have been deleted by another user.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Column 'Title' does not exist. It may have been deleted by another user.]
Microsoft.SharePoint.SPFieldCollection.GetField(String strName, Boolean bThrowException) +26422968
Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException) +47
Microsoft.SharePoint.SPListItem.get_Item(String fieldName) +12
CL.DanceStudio.Portal.CLDance_Instructor.<>c__DisplayClass3.<Select>b__1() +1155
Microsoft.SharePoint.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() +729
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) +27491206
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) +27194345
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) +93
CL.DanceStudio.Portal.CLDance_Instructor.CLDance_InstructorUserControl.Select() +291
CL.DanceStudio.Portal.CLDance_Instructor.CLDance_InstructorUserControl.Page_Load(Object sender, EventArgs e) +52
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.AddedControl(Control control, Int32 index) +350
CL.DanceStudio.Portal.CLDance_Instructor.CLDance_Instructor.CreateChildControls() +194
System.Web.UI.Control.EnsureChildControls() +146
System.Web.UI.Control.PreRenderRecursiveInternal() +61
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
I think it is due to name conflict. Please provide me a solution.

Object reference not set to an instance of an object. c# RADTreeView telerik

I am creating RadTreeView nodes dynamically and I have created it successfully.But When I try to Add a sub-category node to it,sub-category is added successfully but at the end when I am reloading tree I am getting this error:
Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
Telerik.Web.UI.RadComboBox.OnInit(EventArgs e) +40
System.Web.UI.Control.InitRecursive(Control namingContainer) +134
System.Web.UI.Control.AddedControl(Control control, Int32 index) +191
System.Web.UI.ControlCollection.Add(Control child) +86
Telerik.Web.UI.GridPagerItem.InitializePagerItem(GridColumn[] columns) +23849
Telerik.Web.UI.GridPagerItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +170
Telerik.Web.UI.GridTableView.CreateTopPagerItem(Boolean useDataSource, GridColumn[] copiedColumnSet, Boolean isPagingEnabled, GridTHead thead) +93
Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1156
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +679
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +149
System.Web.UI.Control.EnsureChildControls() +83
Telerik.Web.UI.GridTableViewBase.get_Controls() +15
Telerik.Web.UI.GridTableView.GetGridTable() +15
Telerik.Web.UI.RadGrid.PrepareRowsVisibility(GridTableView view) +33
Telerik.Web.UI.RadGrid.PrepareItems() +308
Telerik.Web.UI.RadGrid.ControlPreRender() +64
Telerik.Web.UI.RadCompositeDataBoundControl.OnPreRender(EventArgs e) +41
System.Web.UI.Control.PreRenderRecursiveInternal() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
Dont understand this I tried to debug my code using debug point but everthing is executed alright but at the end I am getting this error.
yes after a long research on my code I got the answer that my grid was getting referenced to null.But its very sad that this is such a famous forum but no one was able to understand the stack trace.
I had this issue after a postback with a radgrid, the problem was the Datasourse was null. To fix it you only have to set DataSource = ""

asp.net caching related to available resource?

I am caching a fairly large datatable into the application cache using:
HttpContext.Current.Cache.Insert(GlobalVars.Current.applicationID + "_" + cacheName, itemToCache, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(240));
As you can see, it should stay in the cache for 4 hours, however we are seeing strange results:
On a site with low CPU & low RAM usage (say 0-150 users) we receive no errors.
On a site with high CPU and low RAM usage (CPU ~90%, 300 - 600 users), we get the following error every 20-60mins:
Cannot find column EditorOrder.
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IndexOutOfRangeException: Cannot find column EditorOrder.
at System.Data.DataTable.ParseSortString(String sortString)
at System.Data.DataView.set_Sort(String value)
at delima_v1._01.templates.results.editors_picks.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
EditorOrder is a column that is added manually to the datatable once the results have been taken from SQL. So i'm unsure if the column is somehow being removed or the entire cache is being lost, the error seems to indicate it's the column being lost. As I said, it only seems to be under high loads so unsure as to whether IIS/Windows have any effect....
Site is running ASP.NET 4.0 in 64bit AppPool
Many thanks in advance,
Dave

DotNetNuke crashed after updating to v6.1.1 from 5.3.1

After updating DNN to the latest version, my site is not working. I suspect it to be a theme-related issue as I have been doing some debugging. But I can not narrow it down further.
The current stacktrace from my site looks like this:
[NullReferenceException: Object reference not set to an instance of an object.]
DotNetNuke.UI.Containers.ActionBase.get_ModuleContext() +6
DotNetNuke.UI.Containers.ActionBase.get_ActionRoot() +30
DotNetNuke.UI.Containers.ActionBase.OnLoad(EventArgs e) +42
[ModuleLoadException: An error has occurred.]
DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(String FriendlyMessage, Control ctrl, Exception exc, Boolean DisplayErrorMessage) +400
[PageLoadException: An error has occurred.]
DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(Exception exc, String URL) +323
DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(Exception exc) +89
DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(String FriendlyMessage, Control ctrl, Exception exc, Boolean DisplayErrorMessage) +525
DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(Control ctrl, Exception exc, Boolean DisplayErrorMessage) +189
DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(Control ctrl, Exception exc) +40
DotNetNuke.UI.Containers.ActionBase.OnLoad(EventArgs e) +85
DotNetNuke.Web.DDRMenu.Actions.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
[PageLoadException: An error has occurred.]
DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(Exception exc, String URL) +323
DotNetNuke.Framework.PageBase.OnError(EventArgs e) +450
System.Web.UI.Page.HandleError(Exception e) +84
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6776
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) in c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\84194812\86a29f2c\App_Web_toxjy2nh.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
From this I can see it has something to do with the DDRMenu component. I've tried my own skins for the site, and for those the exact same line says something about SolPartMenu/Action.
Help is much appreciated!
I had same problem during testing for a move to 6.x and you need to have the latest version of DDR menu, but I suspect that because you can't log-in, you can't install it.
I'm not sure which steps, if any you can cut out of this, but this is what I did.
revert to 5.6.3 from backups
Turn off compression in host settings
Set Minimal Extropy as default skin
set en-US as default language (not sure if this is necessary, it was for one upgrade and I tend to do it for major upgrades now)
Set DNN Nav as the defaut navigation provider in web.config
Change containers to use
<%# Register TagPrefix="dnn" TagName="ACTIONS" Src="~/Admin/Containers/Actions.ascx" %>
Uninstall DDRmenu 1.2.2
Remove DDRMenuNavigationProvider in web.config
Take new backups of database and file system
Upgrade to 6.x
Upgrade to DDR Menu v2.00.0
Set application pool to use .Net4
Re-apply skin to a couple of pages to check all works, if ok reset default skin
Reset compression and default language if necessary
Hope this helps
The problem you're seeing results from a conflict between how the DNN Upgrader runs and how the new DDR Menu wants to be upgraded. The DNN upgrader pushes the DDRMenu.dll into the bin directory but doesn't run the IUpgrade code for it so the DLL, code, and web.config settings don't match. The next version of the DDR Menu should resolve this issue.
Barry's recommendation should resolve the issue though it's more steps than I would take. The first thing I would try is replacing the new DDRMenu DLL (DotNetNuke.Web.DDRMenu.dll) with the old one from before the upgrade and see if that gets your site running. If it does, then you can install the newest version of the DDRMenu and you should be good to go.
If that doesn't work I usually try a combination of code and settings from the code prior to upgrade and good installs of DNN 6.1.1 that did go smoothly until the problem resolves. I wish I had a more specific answer but I'm usually in a hurry (cause the site's down) so I haven't taken the time to write up a more scientific approach.
Again, this should be resolved with the next version of the DDR Menu and the problem only affects sites that were already using the DDR Menu. But still, it's not as smooth as it should be.

Categories

Resources