Yuji
Yuji
Explore posts from servers
CC#
Created by Yuji on 3/23/2025 in #help
Implementing SignalR for Real-Time Notifications with Offline Fallback
I'm exploring how to implement SignalR for push notifications and evaluating two connection management strategies: 1. In-memory tracking with ConcurrentDictionary – Simple but does not persist connections if the server restarts. 2. Storing connections in Redis or a database – More scalable and persistent, suitable for future growth. My Requirements: User Base: 100–200 users (with potential growth). Performance: Notifications should be delivered instantly. Offline Handling: If the app is closed, fallback to Firebase Cloud Messaging (FCM). Self-Hosting: I want to self-host SignalR and am open to exploring both self-hosted SignalR with Kestrel and SignalR with a reverse proxy like Nginx or Apache instead of using Azure SignalR Service. I need reliable resources or guidance to implement this effectively. I have searched online but want to ensure I don’t miss anything. Any recommendations?
52 replies
CC#
Created by Yuji on 3/20/2025 in #help
JWT Token Error
Guys I am having this issue even though jwt token is correct
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[1]
Failed to validate the token.
Microsoft.IdentityModel.Tokens.SecurityTokenMalformedException: IDX14100: JWT is not well formed, there are no dots (.).
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.
---> System.MissingMethodException: Method not found: 'Byte[] Microsoft.IdentityModel.Tokens.Base64UrlEncoder.UnsafeDecode(System.ReadOnlyMemory`1<Char>)'.
at Microsoft.IdentityModel.JsonWebTokens.JsonWebToken.ReadToken(String encodedJson)
at Microsoft.IdentityModel.JsonWebTokens.JsonWebToken..ctor(String jwtEncodedString)
at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ReadToken(String token, TokenValidationParameters validationParameters)
--- End of inner exception stack trace ---
fail: Program[0]
Authentication failed: IDX14100: JWT is not well formed, there are no dots (.).
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[7]
Bearer was not authenticated. Failure message: IDX14100: JWT is not well formed, there are no dots (.).
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[1]
Failed to validate the token.
Microsoft.IdentityModel.Tokens.SecurityTokenMalformedException: IDX14100: JWT is not well formed, there are no dots (.).
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.
---> System.MissingMethodException: Method not found: 'Byte[] Microsoft.IdentityModel.Tokens.Base64UrlEncoder.UnsafeDecode(System.ReadOnlyMemory`1<Char>)'.
at Microsoft.IdentityModel.JsonWebTokens.JsonWebToken.ReadToken(String encodedJson)
at Microsoft.IdentityModel.JsonWebTokens.JsonWebToken..ctor(String jwtEncodedString)
at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ReadToken(String token, TokenValidationParameters validationParameters)
--- End of inner exception stack trace ---
fail: Program[0]
Authentication failed: IDX14100: JWT is not well formed, there are no dots (.).
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[7]
Bearer was not authenticated. Failure message: IDX14100: JWT is not well formed, there are no dots (.).
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.
I don't know what to do my jwt settings are correct, key is correct but still having issue
53 replies
CC#
Created by Yuji on 3/7/2025 in #help
✅ Memory leak or What?
Whenever I call my controller in .net web app, my memory usage gets increased on each call and it never decreases what can be issue?? I will share my code Snippets bellow!
114 replies
CC#
Created by Yuji on 3/6/2025 in #help
Optimizing Filtering and Pagination: Reducing Backend Requests Efficiently
I want to implement filtering and pagination while minimizing backend requests as much as possible. Here’s the challenge:
1)When the page loads, I send the first N records from the backend.
2)The user applies filters, and if matching data exists within those N records, I display it instantly.
3)If no matching data is found in the current N records, I need to check the backend for more data.
4)This means that for every filter change, I might have to query the backend, which increases requests.
1)When the page loads, I send the first N records from the backend.
2)The user applies filters, and if matching data exists within those N records, I display it instantly.
3)If no matching data is found in the current N records, I need to check the backend for more data.
4)This means that for every filter change, I might have to query the backend, which increases requests.
-I know caching can help, but if the filtering logic is complex, managing cache efficiently can also become challenging. -How can I reduce backend requests while handling filtering and pagination efficiently?
29 replies