Base solution for your next web application

Activities of "ofir1234"

Hi. We are using ABP for a website which is divided to three zones: red zone, green zone, yellow zone. In the server side we want to know for each api call, from which zone it came from. Our solution now is just sending the zone as a parameter for each api call. What we want to do is to use routing for that. Is there a way changing the routing somehow to support this idea? For example, all calls coming to /app/services/red/someAppServicewill/someMethod will actually go to the someMethod in the someAppService, and the parameter "zone" will be set to red.

Thanks in advance.

One more question: Is there a reason that the latest version of Asp.Net Boilerplate contains some very old nuget packages? For example, why are you using log4net v1.2.0? (There are plenty of versions above it and the latest one is v2.0.5)

Hi. Recently we've updated some (non-ASP.NET Boilerplate) packages like EntityFramework and more (around 20 packages that visual studio asked to update). The problem is that we now get lots of weird exceptions like "unknown method" from Boilerplate's dll's. We can't really know where the problems are exactly because they come from some Boilerplate dll's we cannot see. Does it mean that if I'm working with ASP.NET Boilerplate, I am not allowed to update packages that ASP.NET Boilerplate framework relies on ? Why isn't there a mechanism which tells that Boilerplate dll's are depended on some other specific dll versions (like entity framework v4.0) so this update would be restricted and the project wouldn't be destroyed? (Boostrap, For example, has this line written in their nugget : Dependencies : jQuery (>= 1.9.1 && < 3.0.0) ) As for now we are working on downgrading those nuget packages (but it's like impossible cause we don't know the previous versions). Anyway, the project is very unstable now (I'm getting these errors only on runtime!). That do you suggest? (We are using the latest ASP.NET Boilerplate versions and nuggests)

Thanks.

Hi. I read a lot of the abp documentation about the generic repository and the uow pattern. But actually I find it hard to find if you have this ability : a generic unit of work working with a generic repository. The concept is explained widely here: <a class="postlink" href="http://www.codeproject.com/Articles/770156/Understanding-Repository-and-Unit-of-Work-Pattern">http://www.codeproject.com/Articles/770 ... rk-Pattern</a> (I'm talking about the mix between the generic uow and the generic repository they are talking about in the end of the article)

Usage example:

var x = uow.Repository<Contact>().GetAll().ToList());
var y = uow.Repository<Manager>().GetAll().ToList());

This means that I can hold (in my application service) an object called uow and then (at runtime) decide to access the contacts repository or the managers repository or any other repository I want. This also saves me from injecting (in the constructor of my application service) all of the repositories I need, for example :

Public MyAppService(IRepository<Contact> cr, IRepository<Manager> mr)
{
// ...
}

If I have something like 15 types of entities, this constructor is going to be huge and its a bit overhead. The best approach is if could only inject this uow object and select my repository from this uow (as I showed in the previous code and in the article example).

So, do you have any support for this concept / can you give a short example for how to do it in ASP.NET Boilerplate?

Thanks :)

Hi. In regular EntityFramework I can just write

Context.Blogs.include(b=>b.posts):

In order to automatically fill posts inside my Blog context. Without this, I m getting null in the posts field when reading the Blogs table using the GetAllList command. How can I do it in boilerplate ? Cause all I do is writing : IDbSet<...> Blogs And that's all I do in order to define the context in boilerplate.

Actually I want to do what's written in here : <a class="postlink" href="https://msdn.microsoft.com/en-us/data/jj574232.aspx">https://msdn.microsoft.com/en-us/data/jj574232.aspx</a>

Thanks

I understand. Nice. One question - how can I tell the client it's a 500 or 400 or 404 server exception this way?

Hi. I'm working with your Dynamic Web API Layer and it's very useful, but I want to understand how can I throw an error to the web client.

I have a client request, defined this way :

abp.services.app.trends.deleteSavedQuery($scope.loadQuerySelectedId)
   .done(function (result) {
      abp.message.info("Saved query deleted successfully");
   });
   //here I want to catch an error (you can't delete a query that wasn't written by you)

The service code in the server is something like this :

[HttpGet]
public void DeleteSavedQuery(int queryId)
{
if (_userManager.AbpSession.UserId == getQueryId(queryId))
   {
      _savedQueriesRepo.Delete(queryId);
   }
   else
   {
      //Here I want to throw an unauthorized error (403) with a message : 'you can't delete a query that wasn't written by you'
   }
}

How can I throw this error from the server and catch it nicely in the client, doing it the best and conventional 'ASP.NET Boilerplate' way ?

Thanks.

Any other way to change the admin password ? I just need to change it.

Hi. Is there an easy way to change the admin password via code ? I tried resolving the UserManager and then changing the password for user no 1, like this :

await _userManager.ChangePasswordAsync(1, "123qwe","blabla");

But the password is still the same. So how can I do it ?

Thanks.

Hi. Your LDAP solution is working really good, although I've noticed one problem today. In our company, it is possible to get into the domain when you are not physically at the office (VPN). But it seems that the ASP.NET Boilerplate framework can't communicate with the LDAP server when I'm connecting from VPN. This means that no one can log- into my website when he is outside the office (and using the VPN), not even the admin user (admin,123qwe). When I'm on this VPN mode, I'm actually in the domain, and everything should work the same. But it doesn't, and no one can log in from outside, nor register a new user.

Attaching the error message a user (which is trying to register) receives (when trying to connect it just says login failed):

Server Error in '/' Application.

The LDAP server is unavailable.

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.DirectoryServices.Protocols.LdapException: The LDAP server is unavailable.

Source Error: 


Line 98:         private async Task<AbpUserManager<Tenant, Role, User>.AbpLoginResult> GetLoginResultAsync(string usernameOrEmailAddress, string password, string tenancyName)
Line 99:         {
Line 100:            var loginResult = await _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);
Line 101:
Line 102:            switch (loginResult.Result)

Source File: C:\Workspace\multiproject\myproject\myproject.Web\Controllers\AccountController.cs    Line: 100 

Stack Trace: 


[LdapException: The LDAP server is unavailable.]
   System.DirectoryServices.Protocols.LdapConnection.Connect() +79437
   System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID) +212
   System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout) +88
   System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request) +17
   System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties) +363

[PrincipalServerDownException: The server could not be contacted.]
   System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties) +449
   System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval() +64
   System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password) +285
   System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, String userName, String password) +56
   Abp.Zero.Ldap.Authentication.<CreatePrincipalContext>d__13.MoveNext() +1988
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Zero.Ldap.Authentication.&lt;TryAuthenticateAsync&gt;d__0.MoveNext() +502
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Authorization.Users.<TryLoginFromExternalAuthenticationSources>d__52.MoveNext() +643
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Authorization.Users.&lt;LoginAsync&gt;d__40.MoveNext() +1487
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   myproject.Web.Controllers.<GetLoginResultAsync>d__10.MoveNext() in C:\Workspace\multiproject\myproject\myproject.Web\Controllers\AccountController.cs:100
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   myproject.Web.Controllers.&lt;Register&gt;d__16.MoveNext() in C:\Workspace\multiproject\myproject\myproject.Web\Controllers\AccountController.cs:261
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Threading.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__10`1.MoveNext() +575
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter.GetResult() +26
   System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +42
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +73
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass37.&lt;BeginInvokeAsynchronousActionMethod&gt;b__36(IAsyncResult asyncResult) +37
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +68
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.AsyncInvocationWithFilters.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3d() +69
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f() +230
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass33.&lt;BeginInvokeActionMethodWithFilters&gt;b__32(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +68
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2b.&lt;BeginInvokeAction&gt;b__1c() +42
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult asyncResult) +124
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +29
   System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +27
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +32
   Castle.Proxies.AccountControllerProxy.EndExecuteCore_callback(IAsyncResult asyncResult) +4
   Castle.Proxies.Invocations.Controller_EndExecuteCore.InvokeMethodOnTarget() +55
   Castle.DynamicProxy.AbstractInvocation.Proceed() +86
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) +97
   Castle.DynamicProxy.AbstractInvocation.Proceed() +114
   Castle.Proxies.AccountControllerProxy.EndExecuteCore(IAsyncResult asyncResult) +142
   System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__15(IAsyncResult asyncResult, Controller controller) +26
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +40
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   Castle.Proxies.AccountControllerProxy.EndExecute_callback(IAsyncResult asyncResult) +26
   Castle.Proxies.Invocations.Controller_EndExecute.InvokeMethodOnTarget() +55
   Castle.DynamicProxy.AbstractInvocation.Proceed() +86
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) +97
   Castle.DynamicProxy.AbstractInvocation.Proceed() +114
   Castle.Proxies.AccountControllerProxy.EndExecute(IAsyncResult asyncResult) +142
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +24
   System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +27
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +29
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +23
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0

Any suggestion ?

Showing 1 to 10 of 22 entries