reeeeeee
reeeeeee
CC#
Created by reeeeeee on 2/26/2024 in #help
ReCaptcha verify - The response ended prematurely
I an getting this error, when sending captchaData to the server for verifying. I would think the problem would be with accessing internet connection, but as far as I can see, the recaptcha verifying site can be accessed from the server. (https://www.google.com/recaptcha/api/siteverify) Any idea what else can i check?
18 replies
CC#
Created by reeeeeee on 2/23/2024 in #help
ReCaptcha verify - The response ended prematurely
Kinda all in the title. I would think the problem would be with accessing internet connection, but as far as I can see, the recaptcha verifying site can be accessed from the server. (https://www.google.com/recaptcha/api/siteverify) Any idea what else can i check?
1 replies
CC#
Created by reeeeeee on 1/17/2024 in #help
✅ Verify ReCaptcha on private server
I have implemented ReCaptcha that is deployed to private server which does not have access to internet. I have to whitelist the ReCaptcha verifying URL. In the docs https://developers.google.com/recaptcha/docs/verify there is this url https://www.google.com/recaptcha/api/siteverify. So if I whitelist this URl, the captcha should work? Or does anything else need to be whitelisted? What are the odds that google will change this url?
5 replies
CC#
Created by reeeeeee on 1/11/2024 in #help
LDAP authentication stopped working for one user
Hey all! I had an LDAP auth implemented on my site, which worked fine for past two years, but randomly stopped working for one user after he changed password. The code is like this
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;

}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;

}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
I am getting returned the username or password is incorrect. Should I implement this better? How can I even debug this? Can I check anything on the AD / LDAP side?
13 replies
CC#
Created by reeeeeee on 12/22/2023 in #help
Captcha service
I am implementing an announcement form for our client and I need to implement the Captcha step before the submit. I am using angular SPA and .net 7 MVC (with separate controllers for SPA). I see that the most popular captcha services are google recaptcha and hCaptcha, where you need to register your page, and other captcha services are kinda outdated. Would be better to just use the reCaptcha/hCaptcha, or is it worth implementing it on my own?
3 replies
CC#
Created by reeeeeee on 12/19/2023 in #help
LDAP login after password change
I have an older implementation of the Web API for AD users login with LDAP path. Technically everything worker for the past few years, but now the client said that after he changed his password, he can't login to the app anymore. This occured a few weeks ago, so I think that all of the "LDAP syncing" went trough already... I tried to duplicate this, and after password change, actully both new and old passwords worked fine. After like one hour, the old password stopped working and only the new one works now. This is my implementation of the login, I see there are different kinds of approach, is there any better one that would kinda "force" to use only the latest password?
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
1 replies
CC#
Created by reeeeeee on 12/3/2023 in #help
How well do deployed .NET Framework apps handle .net update?
For example, if I have .Net 4.5 Framework application deployed on Windows server, how well does it handle any .NET Framework updates? If I keep .NET 4.5 version on the server, and install .net framework 4.8 or .NET Core, could this stil be problematic, since the 4.5 is still installed? What about Security Updates for Microsoft .NET Framework, this shouldn't cause any problems, right?
13 replies
CC#
Created by reeeeeee on 11/24/2023 in #help
Decoding RFID tag
Is anyone familiar with decoding RFID tags? I have bytearray but idk where to start from here (Whihch part is tag value, which part specify it, etc.). Any advice would be appreciated.
6 replies
CC#
Created by reeeeeee on 7/7/2023 in #help
✅ Problems with NHibernate, FluentNHibernate, StructureMap
I have been trying to fix this bug in an older project (which needed to be updated to .net framework 4.6.1, because of some other newer libraries), but I just didn't really make any progress. I will post some of the stack trace, but please let me know what else should I include (except whole project, lol), so it would be easier to help.
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at FluentNHibernate.AssemblyTypeSource.GetTypes()
at FluentNHibernate.PersistenceModel.AddMappingsFromSource(ITypeSource source)
at FluentNHibernate.Cfg.FluentMappingsContainer.Apply(PersistenceModel model)
at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateFactory()
at TSTrumpet.Web.DataAccessRegistry.<>c.<.ctor>b__1_0(IContext ctx) in C:\Users\naczup\tstrumpet\TSTrumpet.Web\DataAccessRegistry.cs:line 26
at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session)
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at FluentNHibernate.AssemblyTypeSource.GetTypes()
at FluentNHibernate.PersistenceModel.AddMappingsFromSource(ITypeSource source)
at FluentNHibernate.Cfg.FluentMappingsContainer.Apply(PersistenceModel model)
at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateFactory()
at TSTrumpet.Web.DataAccessRegistry.<>c.<.ctor>b__1_0(IContext ctx) in C:\Users\naczup\tstrumpet\TSTrumpet.Web\DataAccessRegistry.cs:line 26
at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session)
7 replies
CC#
Created by reeeeeee on 6/25/2023 in #help
❔ Remove Index from URL
How do I remove "Index" from Url, so I can call /Home, /Users, etc, wihtout additional /index. (but obv be still redirected to "Index" method in controller. I found this snipped and added it to my startup
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action}/{id?}");
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action}/{id?}");
Well, the Index is still there, and all actions without "Index" are redirected to my Users/edit/{id} action..
20 replies
CC#
Created by reeeeeee on 6/24/2023 in #help
❔ Razor pages - Filtering data (shown in table) by some random filters
As mentioned in title, I am showing some data in table, and I need some filters, like serialNumber, dateFrom, DateTo, No, Status,... How could I implement this functionality in mvc razor pages? One way would be to append all those filters into the URL, is this proper way to do it? (I was thinking on looking for something without all those mess in url) Thanks!
18 replies
CC#
Created by reeeeeee on 6/19/2023 in #help
❔ Anyone worked with Zebra scanners?
Title. Especially FX7500 and FX9600, and maybe even Zebra IoT connector.. (before I write and explain the whole content, i would firstly like to know if anyone even worked with this, heh)
16 replies
CC#
Created by reeeeeee on 6/17/2023 in #help
❔ Session vs Cookies vs Cache
I am currently researching this, but just cant find an end on which one should I use. Like, what are the main differences? I need it for simple authentication (user/pass) of my web app (3-4 pages) and automatic logout if inactive too long.l.
27 replies
CC#
Created by reeeeeee on 6/14/2023 in #help
❔ AspNetCore web MVC app - Authentication
I would like to implement some authentication to my web app. I would like to make it "proper" and not too complex. All I need would be Username, Password, Session. The app would be for internal use, so no additional functionalities like forgot pass or email confirmation will be needed. Do you have any tutorial/guide/recommendation I could follow? Thanks!
11 replies
CC#
Created by reeeeeee on 6/7/2023 in #help
❔ MVC app architecture which is consuming 3rd party API
I am developing a fresh MVC app, but because I usually maintain/upgrade existing app, I am not really sure how to approach this from the architecture perspective, so I won't make too big of a mess. My solution is currently made out of 2 layers: - UI Layer (controllers, viewmodel, resx translations) - Data layer (Entities, dbContext, migrations, Services, IServices) - I am not sure if this is correct or if there is any benefit, having service (control database entity) and its interface in the same project? And about the consuming 3rd party API - this app will partly work with Zebra FX7500 RFID reader, which is controlled over its API. How/Where would I put this RFID controlling logic? I would need a few methods for it - Authenticate, start, stop, ping,.. I would also have some DTOs, and I think thats it. Should I create another project inside the solution, something like "Reader management" (and if yes, what type would this be, and what else would I need)? Or should I put it somewhere in UI layer, since its not that complex? Thanks for your help!
5 replies
CC#
Created by reeeeeee on 5/23/2023 in #help
❔ MVC template with simple user/pass auth
2 replies
CC#
Created by reeeeeee on 5/16/2023 in #help
❔ MVC template with simple user/pass auth
Is there any existing built-in template for MVC (.net 7) application, with already implemented auth/session/etc for a simple user/pass users? Or should I implement it by myself?
4 replies
CC#
Created by reeeeeee on 5/5/2023 in #help
❔ Invalid remote certificate, error in certificate chain: Partial chain
When I am sending this GET request from my machine in VS, everything works perferctly normal. When I deploy this soulution to some remote server, I am getting the error from title. Any idea what would it mean? I would assume its something wrong with the certificate of the server where the API is located, but then it shouldnt work from my machine either, right?
21 replies
CC#
Created by reeeeeee on 4/3/2023 in #help
❔ Convert cshtml view to PDF file
Basically title. I had this functionality working already, but its working weirdly slow sometimes... its also probably not the best, because I am geenrating it with Puppeteer, so technically I am opening the html content in the hidden browser, and then downloading it from there. What would be the best free option to do this?
9 replies
CC#
Created by reeeeeee on 3/29/2023 in #help
❔ Render email content .NET 7 (razor)
I have to reinplement email content rendering, because currently its not looking really good, especially not on mobile. Right now, we are rendering cshtml view and sending its content, but as mentioned before, styling and responsiveness is not so good, especially on mobile... Do you have any idea how could I improve that, maybe use any other library/framework or something like that?
14 replies