Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "ashvinu"

Hello,

the infrastructure guy on our side managed to solve the problem with the redirection server and we are now able to download Excel using the IDistributedCache.

Thanks and Regards Kirtee

Hello,

we figured out that the problem is actually with the direction server on the production environment.

The redirection is not able to read after the "?" in the url, for example: https://website/File/DownloadTempFile?fileType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&fileToken=dd24ea6494374d4a8d5565e605eea86c&fileName=AuditLogs.xlsx

We are trying to look for a solution, but just in case you have any idea, please let us know.

Thanks and Regards

Hello, no we are not using Redis.

I have tried using IDistributedCache.

I haved added the following in the Startup.cs

   services.AddDistributedSqlServerCache(options =>
            {
                options.ConnectionString = _appConfiguration["ConnectionStrings:Default"];
                options.SchemaName = "dbo";
                options.TableName = "CacheForTokens";
            });

and have modified the TempFileCacheManager.cs as follows:

     public class TempFileCacheManager : ITempFileCacheManager
    {
        private readonly IDistributedCache _cacheManager;

        public TempFileCacheManager(IDistributedCache cacheManager)
        {
            _cacheManager = cacheManager;
        }


        public void SetFile(string token, byte[] content)
        {
            _cacheManager.Set(token, content);

        }

        public byte[] GetFile(string token)
        {
            return _cacheManager.Get(token) as byte[];
        }
    }

I see that the token and value is saved successfully in the table when I try to export to Excel,

but I am still getting the file not found error

Do you have any idea about what is missing to get this working?

Thanks and Regards

  • What is your product version? v9.1.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hello.

We have an ASP.Net zero project built in ASP.NET CORE MVC & jQuery, .NET Core 3.1 and v8.1.0. This project serves as a signle sign on platform.

We have another project which is of type ASP.NET CORE & Angular, .NET Core 3.1 and v9.1.0. This project has 2 types of login; 1 for internal users and one which should do SSO through the other MVC application.

Can you please provide some assistance on how we can tackle this situation.

Thanks and Regards

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 8.1.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? >net core

Hi,

we have deployed the application on a production environment which consists of a web farm, a load balancer and 2 IIS servers (windows server 2019). When trying to export results to Excel, I get an error that the file can't be found or does not exist.

Note that we also have a pre production environment with only 1 IIS server and no load balancer. And export to Excel works fine on this environment.

I think the the problem is that the file is being saved on a temp file cache.

Do you have any sample code on how to override this behaviour and save the file temporarily somewhere other than cache?

Thanks and Regards

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 8.1.0
  • What is your product type (Angular or MVC)? MVC and JQuery
  • What is product framework type (.net framework or .net core)? .Net Core 3.1

Hi,

we have pushed the source code to Bitbucket. The yarn and npm run create command works fine on my machine. But when I pulled the code on another machine and run the npm rrun create-bundles command, I get the following error:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'create-bundles'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'precreate-bundles', 'create-bundles', 'postcreate-bundles' ]
5 info lifecycle [email protected]~precreate-bundles: [email protected]
6 info lifecycle [email protected]~create-bundles: [email protected]
7 verbose lifecycle [email protected]~create-bundles: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~create-bundles: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\MauPass\mitcinaf\src\MTCI.MauPass.Web.Mvc\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Local\Yarn\bin;C:\Users\Administrator\.dotnet\tools
9 verbose lifecycle [email protected]~create-bundles: CWD: C:\MauPass\mitcinaf\src\MTCI.MauPass.Web.Mvc
10 silly lifecycle [email protected]~create-bundles: Args: [ '/d /s /c', 'gulp buildDev' ]
11 silly lifecycle [email protected]~create-bundles: Returned: code: 1  signal: null
12 info lifecycle [email protected]~create-bundles: Failed to exec create-bundles script
13 verbose stack Error: [email protected] create-bundles: gulp buildDev
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\MauPass\mitcinaf\src\MTCI.MauPass.Web.Mvc
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "create-bundles"
18 verbose node v12.18.2
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] create-bundles: gulp buildDev
22 error Exit status 1
23 error Failed at the [email protected] create-bundles script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Please assist urgently.

Thanks and Regards

Hi, is there a way I can clear the cookie from the browser when the user is logged out on session timeout? Alternatively, what is the equivalent of Session.Abandon(); in ASP.Net Zero?

Thanks and Regards

Applying the code change mentioned at https://github.com/tmenier/Flurl/issues/495#issuecomment-579841595 solved the issue for me

  • What is your product version? 8.6
  • What is your product type (Angular or MVC)? MVC and Jquery
  • What is product framework type (.net framework or .net core)? .Net core

Hello,

I have enabled the session timeout settings and set the value to 15minutes. After 15minutes of inactivity, I am redirected back to the login page. When I try to login again, I get an error and it says error detail not provided by the server. I get the following from the logs:

ERROR 2020-09-15 15:58:01,046 [60   ] spNetCore.Antiforgery.DefaultAntiforgery - An exception was thrown while deserializing the token.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted.
 ---> System.Security.Cryptography.CryptographicException: The key {b8f7b4e7-46d4-4309-8d00-f21ad7e8583d} was not found in the key ring.
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext)

I have configured data protection as per Microsoft documentation available at https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#data-protection and I see the key is being stored at %LOCALAPPDATA%/ASP.NET/DataProtection-Keys folder on the IIS server. I have alspo implemented Distributed SQL server cache (https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-3.1#distributed-sql-server-cache) but error keeps on popping up.

Note that the issue happens intermittently and the error goes away if I refresh the browser and try to login again.

Is there a way that I can refresh the browser automatically when the user is logged out when his session times out?

Thanks Kirtee

Answer

Hello,

something like the below:

A user can login using their username and password OR using QR code scanned by a mobile app (developed by us).

Regards

Showing 1 to 10 of 24 entries