I am stuck into a problem here and need a hint from someone.
I am using my own SQL Server database for managing users and roles (as opposed to aspnet DB). It was working fine until I added some custom fields to the aspnet_membership table. After doing so, I cannot create a new user through the asp.net web administration tool. The following exception is thrown:
An error was encountered. Please return to the previous page and try again.
The following message may help in diagnosing the problem: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Web.Administration.WebAdminMembershipProvider.CallWebAdminMembershipProviderHelperMethodOutParams(String methodName, Object[] parameters, Type[] paramTypes) at System.Web.Administration.WebAdminMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
This occurs only at the time of user creation. Everything else is working fine. I have already tried running the aspnet_regsql utility again. Any other suggestions? Any help will be most appreciated.
--
Ali
At a guess, are any of the fields you have added defined as Not NULL and have no defaults?
If so, make sure you populate them in the code that addes a user.
Are the extra columns allowed to hold null values? Have you defined suitable default values if they aren't?
Did you update the Stored Procedures that write to the membership tables? If so, then you'll need to write a custom membership provider to populate them - what sort of details are they?
It would probably be better to store these values against a Profile for the user - unless they are explicitly to do with their membership, in which a custom provider is the way to go.
Edit to respond to Ali's comments
In that instance (marking an account as deleted/inactive) then yes, it probably makes sense to store that against the membership table - they are to do with the users membership of the site.
However - the main issue I can see with your approach is that if you're using the default Login controls, the user can still log in initially, and then you'd need to be checking the value of the Deleted field in either the LoggingIn (before Authentication) or LoggedIn (after) event handlers - you might be able to get away with modifying the built in IsApproved property to handle this by default.
Thanks Zhaph and Oded. The NULL values were problem.
But Zhaph pointed out towards another issue I would like to know more. The additional details are like isDeleted, where I just mark isDeleted as true without actually having to delete the user and then some relevant details for audit like deletedByUser, dateDeleted etc. (and some application specific).
I did not update the stored procedures that write to the membership tables. Instead, I have some additional SPs which fill in the extra details as soon as the user is created. Is that(storing field in membership table and writing new procedures) a correct way to approach?
Related
We are querying database using LINQ-SQL and then storing resulting master table objects in HTTP cache.
Later, the master objects are being used to query its children, using lazy loading. Here are the relevant pieces of code - I have recreated the scenario in a new proof-of-concept app:
if (HttpRuntime.Cache["c"] == null)
{
LockApp.Models.DBDataContext db = new Models.DBDataContext();
var master = db.Masters.ToList();
HttpRuntime.Cache.Add("c", master,
null, DateTime.Now.AddMonths(1),
TimeSpan.Zero, CacheItemPriority.Normal, null);
}
ViewBag.Data = (List<LockApp.Models.Master>)HttpRuntime.Cache["c"];
And here's the razor view that is iterating over master and detail objects:
#foreach(var m in ViewBag.Data){
#m.Id<nbsp></nbsp>
foreach(var d in m.Details){
#d.Id<nbsp></nbsp>
}
<br />
}
It works perfectly fine and caches the data correctly. However, it fails when there are multiple requests trying to hit the web site after cache is cleared - I am testing this using JMeter, basically hitting the site with many (50) parallel threads, and then touching web.config - I immediately start seeing one of the following two errors:
Index was outside the bounds of the array
at foreach(var d in m.Details)
this error never goes away, i.e. some data gets corrupted in cache
with following stack:
System.Collections.Generic.List`1.Add(T item) +34
System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) +305
System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +59
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +118
System.Data.Linq.SqlClient.CompiledQuery.Execute(IProvider provider, Object[] arguments) +99
System.Data.Linq.DeferredSourceFactory`1.ExecuteKeyQuery(Object[] keyValues) +402
System.Data.Linq.DeferredSourceFactory`1.Execute(Object instance) +888
System.Data.Linq.DeferredSource.GetEnumerator() +51
System.Data.Linq.EntitySet`1.Load() +107
System.Data.Linq.EntitySet`1.GetEnumerator() +13
System.Data.Linq.EntitySet`1.System.Collections.IEnumerable.GetEnumerator() +4
ASP._Page_Views_Home_Index_cshtml.Execute() in c:\Users\prc0092\Documents\Visual Studio 2012\Projects\LockApp\LockApp\Views\Home\Index.cshtml:16
or this error
ExecuteReader requires an open and available Connection. The connection's current state is open.
at the same line foreach(var d in m.Details)
this error does go away after a while if I stop hitting the site with parallel requests
with following stack
System.Data.SqlClient.SqlConnection.GetOpenConnection(String method) +5316460
System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +7
System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +155
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +82
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +134
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
System.Data.Common.DbCommand.ExecuteReader() +12
System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +1306
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +118
System.Data.Linq.SqlClient.CompiledQuery.Execute(IProvider provider, Object[] arguments) +99
System.Data.Linq.DeferredSourceFactory`1.ExecuteKeyQuery(Object[] keyValues) +402
System.Data.Linq.DeferredSourceFactory`1.Execute(Object instance) +888
System.Data.Linq.DeferredSource.GetEnumerator() +51
System.Data.Linq.EntitySet`1.Load() +107
System.Data.Linq.EntitySet`1.GetEnumerator() +13
System.Data.Linq.EntitySet`1.System.Collections.IEnumerable.GetEnumerator() +4
ASP._Page_Views_Home_Index_cshtml.Execute() in c:\Users\prc0092\Documents\Visual Studio 2012\Projects\LockApp\LockApp\Views\Home\Index.cshtml:16
Different things I tried
Double locking
Doesn't help
private static object ThisLock = new object();
public ActionResult Index()
{
if (HttpRuntime.Cache["c"] == null)
{
lock (ThisLock)
{
if (HttpRuntime.Cache["c"] == null)
{
Loading child data upfront
Works, but requires constant maintenance as not all children should be loaded upfront, plus see next note
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Master>(b => b.Details);
db.LoadOptions = dlo;
Locking the master object while trying to access its children
Again, requires maintenance as all initial places where child is accessed need to be found - we are struggling with this as there are different entry paths into the site
#foreach(var m in ViewBag.Data){
#m.Id<nbsp></nbsp>
lock (m){
foreach(var d in m.Details){
#d.Id<nbsp></nbsp>
}
}
<br />
}
Switching to entity framework
This seems to still have (sometimes - much better than linq-sql) the "open connection" issue at certain number of parallel requests (50+ on core i7) - it does go away after a while as I mentioned and I haven't seen data corruption yet.
We may end up switching to EF completely as this seems to be the only viable path - assuming data corruption doesn't show up - that is to be tested on my actual project.
I am not optimistic though, as EF data context is not thread safe either, and I think the EF data objects carry their context with them. This is probably the only question that I don't have answer to yet.
Theories on why it's broken
It looks like storing LINQ-SQL object in http cache carries the data context with it. When this context is later used by multiple threads to access children, there is some type of concurrency issue that manifests itself in either temporary connectivity issue or complete data corruption of the child object. As there's no way to disconnect/reconnect the context from the LINQ object, it looks like the only suggestion is not to cache LINQ objects that need lazy-loading of their children - a substantial number of google searches I did does not seem to give you that advice, in fact sometimes it's opposite.
I have uploaded the complete project (for Visual Studio 2012 and SQL Server 2012)
https://docs.google.com/file/d/0B8CQRA9dD8POb3U5RGtCV3BMeU0/edit?usp=sharing
and a simple JMeter script that will hit your local machine with parallel requests:
https://docs.google.com/file/d/0B8CQRA9dD8POd1VYdGRDMEFQbEU/edit?usp=sharing
to test, start the site and run the test - then touch the web.config on the site
LockApp.Models.DBDataContext db = new Models.DBDataContext();
var master = db.Masters.ToList();
You should have a call to db.ObjectTrackingEnabled = false in between these two calls. Otherwise all of the objects will be tracked by the datacontext so that changes can be written back into the database. Since you're caching these objects to be read by multiple threads, you do not want this. (It's also more expensive even in single-threaded cases to track objects you won't change, so worth doing in other places).
Also, use LoadWith to eagerly load any properties you might want to access of these cached entities, so they are all loaded on the initial caching thread, rather than with (potentially mulitple) threads that try to access them.
I'm receiving the below exception when I launch the page for debugging. The objectDataSource is configured for an ADO TableAdapter which queries an oracle database. The ods is then bound to an ASP.NET Gridview. I am coding against .NET 4.0.
If I leave the gridview unbound, there are no problems when launching. I can do as much as completely configure the ods, define columns and row behavior for the gridview, etc, and there are no issues. I am using (to my knowledge) the same methodology that I have successfully used many times in the past to access and display the data. I've been through the code as closely as I can imagine, and haven't been able to pick out the problem.
Exception Info:
Capabilities:Type=IE7,Name=IE,Version=7.0,MajorVersion=7,MinorVersion=0,Platform=WinNT,IsBeta=False,IsCrawler=False,IsAOL=False,IsWin16=False,IsWin32=True,SupportsFrames=True,SupportsTables=True,SupportsCookies=True,Ecmascriptversion=3.0,SupportsVBScript=True,SupportsJavaApplets=True,SupportsActiveXControls=True,CDF= False
Inner Exception Type: System.Reflection.TargetInvocationException Inner Exception: Exception has been thrown by the target of an invocation.
Inner Source: mscorlib
Inner Stack Trace: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
The Markup:
<asp:GridView ID="gvGradename" runat="server" AutoGenerateColumns="False"
DataKeyNames="GRADENAME_ID" DataSourceID="odsGradename">
<Columns>
//Which columns are displayed are irrelevant. The error occurs with any columns, including none.
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsGradename" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetDataByActiveName"
TypeName="pts.PTSTableAdapters.PTS_GRADENAMETableAdapter">
</asp:ObjectDataSource>
The query:
select gn.gradename_id
, gn.mill_id
, case when gn.gradename_id = 0 then upper(gn.name) else initcap(gn.name) end name
, m.name millname
, gn.audit_id
, gn.audit_dtm
, gn.audit_insert_dtm
, gn.audit_process_code
, gn.description
, gn.roll_width_threshold
from pts_gradename gn
, pts_mill m
where gn.is_generic = 1
and gn.is_active = 1
and gn.mill_id = m.mill_id
order by case when gn.gradename_id = 0 then null else initcap(gn.name) end nulls first
I'm not doing anything with it in the code-behind, at the moment.
EDIT: included tablenames in the query, where they had been redacted, previously.
Also, I can preview the data in the table adapter, and receive the expected information, so it appears not to be a problem with the query itself.
The problem was with the auto-generated Fill method associated with the datatable. I wasn't able to determine what exactly the problem was, but deleting it and starting over fixed the problem.
Not really a great answer, but it was the solution to this particular issue.
I have an asp.net application in which I am receiving the following error message: -
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Stack Trace:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.FormView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.FormView.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.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.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
In an effort to debug the error I have turned the EnablePartialRendering setting to false but this didn't help and the error was displayed in exactly the same way.
The only clue I have is that in the Output window for Debug I am seeing this message: -
'A first chance exception of type 'System.InvalidCastException' occurred in App_Code.iqmc5gba.dll'
Whilst this indicates that the error is occurring within the code held in the App_Code folder I'm actually none the wiser as there are 211 files that would appear to be contributing to the content of the dll as they are all named App_Code.iqmc5gba.nnn.cs where nnn is a number between 0 and 210
At the time ther error occurs the code is getting the data to display a record in a formview. The error only occurs on one record in the database that I can see at the moment.
Is anyone aware of any techniques that I can use to try and identify the line of code that is being executed at the point the invalidcastexception is encountered?
This typically happens when reading data (using a datareader, for example) and certain column comes back null when you actually expect it to have at least some value. Consider this code:
int age = (int)reader["age"]; //will throw ClassCastException if null
If for some reason the result set contains a null value on the age column, the value held by reader["age"] will not be an integer but rather a DBNull.Value which is a different type; hence the ClassCastException.
If you don't have access to the source code, your best bet is to make compare a good record with the bad one and make sure that corresponding columns on both records have values.
I was having the same issues. Not sure if you have fixed your problem but Icarus is on the correct path. What I found was that in some cases you need to set the security question for an account to be created. I solved the problem by opening the ASP.Net Config under the Project Tab in VS2012. Click on the Provider Tab and Select a Provider for site management (Single in my case). Once that is active and you test the connection, when you go back to add a new user, there will be an option to enter a security question and answer. This seems to fix the problem.
I have a problem configuring multiple hostnames in Composite C1.
Background:
I have two websites in C1: site1 and site2. The C1 installation is mainly for site1 and works with the host www.site1.com (and alias site1.com).
Now I've added another site, site2, to C1. When browsing to site1.com/site2 I end up on the site2 website. All fine. Then I try to add another hostname, www.site2.com, to URL Configuration -> Hostnames. After adding www.site2.com and browsing to www.site2.com I get the following exception: "Item has already been added. Key in dictionary: '' Key being added: ''"
The stacktrace looks as follows:
[ArgumentException: Item has already been added. Key in dictionary: '' Key being added: '']
System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9353115
System.Collections.Hashtable.Add(Object key, Object value) +11
Composite.Core.Collections.Generic.Hashtable`2.Add(TKey key, TValue value) +105
Composite.Plugins.Routing.Pages.PageUrlBuilder.BuildUrlSet(IPage page, Guid parentPageId) +1935
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable`1 elements, IDictionary`2 urlToIdLookup, IPageUrlBuilder builder) +253
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildMap(UrlSpace urlSpace) +2200
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetMap(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) +482
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetPageUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) +9
Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String relativeUrl, UrlSpace urlSpace, UrlKind& urlKind) +311 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String absoluteUrl, UrlKind& urlKind) +306 Composite.Core.Routing.Pages.C1PageRoute.GetRouteData(HttpContextBase context) +156
System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +287
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60
System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Does anyone have a solution for this?
Thanks in advance...
UPDATE:
After changing the dll suggested by Dmitry Dzygin I get the following stack trace:
[ArgumentException: Item has already been added. Key in dictionary: '' Key being added: '']
System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9353115
System.Collections.Hashtable.Add(Object key, Object value) +11
Composite.Core.Collections.Generic.Hashtable`2.Add(TKey key, TValue value) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\Collections\Generic\Hashtable.cs:28
Composite.Plugins.Routing.Pages.PageUrlBuilder.BuildUrlSet(IPage page, Guid parentPageId) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\PageUrlBuilder.cs:190
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable`1 elements, IDictionary`2 urlToIdLookup, IPageUrlBuilder builder) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:630
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable`1 roots, IPageUrlBuilder pageUrlBuilder, IDictionary`2 urlToIdLookup) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:612
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildMap(UrlSpace urlSpace) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:559
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetMap(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:277
Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetPageUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:342
Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String relativeUrl, UrlSpace urlSpace, UrlKind& urlKind) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\DefaultPageUrlProvider.cs:249
Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String absoluteUrl, UrlKind& urlKind) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\DefaultPageUrlProvider.cs:206
Composite.Core.Routing.Pages.C1PageRoute.GetRouteData(HttpContextBase context) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\Routing\Pages\C1PageRoute.cs:90
System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +287
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60
System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Looks like some of kind of a url collision when 2 C1 pages received the same url or something like that. As a solution I recommend you to copy debug version Composite.dll file and Composite.pdf files to the /bin folder of your website. You can find those at Codeplex in "Other available downloads section" of the release page ( http://compositec1.codeplex.com/releases/view/80764 ) After that you will see the exact line in the code that caused it. Once you have it, I'll be able to either fix it or to add some code assertions/validation logic.
Update.
Looking through code it appears that the exception is possible only if you have 2 websites with empty "UrlTitle" field. Normally there's validation logic that prevents this situation from happenning. Try to edit both website's roots, give them not empty "Url Title" fields, and publish them afterwards, that should solve the issue. If the bug is still persists, I either need a better repro (I failed to reproduce it with the provided one), or if you send me a copy of a website, I'll debug it.
I have written code to send an email with a link to a URL, which the user has to click for confirmation.
Sample Link:
http://localhost:3531/VerificationModule/VerifyEmail.aspx?TemplateID=519457608&F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLeMU5i6KWEZculKhM0IOhYFaMc-DsB
But when the user clicks the link, it gets opened in the browser, but displays the following error.
"Buffer cannot be null. Parameter name: buffer"
Please find below the stack trace:
[ArgumentNullException: Buffer cannot be null.
Parameter name: buffer]
System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +9629927
System.IO.MemoryStream..ctor(Byte[] buffer) +6
Auth.IdentityTokenXChangeData.Deserialize(String base64Package) +187
Auth.IdentityTokenXChange.TrySniffIdentityToken(HttpRequest req, String& sessionId, String& sessionTag, String& returnUrl) +244
Auth.IdentityModule.OnBeginRequest(Object sender, EventArgs e) +365
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +220
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +120`
This is eating up my day. Any suggestion would be of great help.
Got a clue on the error..
I believe the problem is with Encoded value in the QueryString
("F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLeMU5i6KWEZculKhM0IOhYFaMc-DsB") -
The Base64 Decode is returning 'null' for some reasons.
Method -
'System.Web.HttpServerUtility.UrlTokenDecode
("F960866879F669E=Tw5NpFeW9HsAqc_Ap5dmOwqkZ041pFQGYLxRV-puumtHsfhrTYtDe51uCbGV44Kc1X3n6cggsynfqRmh74ie535ymkvATeK5Jii11tOMIZDZ_GVB8QolLeMU5i6KWEZculKhM0IOhYFaMc-DsB")'
Any idea on why it returns null? Is it not a valid Base64 encode?
It means the Auth.IdentityTokenXChangeData.Deserialize method creates a new MemoryStream instance with a null buffer argument.
This method seems specific to your code / environment (there is an Auth.IdentityModule in your site), so you need to take a look at it.