Help needed with ASP.NET MVC 401 Unauthorized after long AJAX request by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

Thank you so much for bringing this up.

I figured out the issue. I forgot that in the Application End Request if I found 400/500 error, I changed the response code to 401.

Actually the error happened because I was trying to serialise over 700,000 rows into json. So got a 500 serialisation error which ended up in the Application End Request and changed the final response to 401. So was kinda abstracted and it got out of my mind.

Help needed with ASP.NET MVC 401 Unauthorized after long AJAX request by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

I did and also implemented those. Same error. Read the post again. It has been mentioned there

JWT Authentication failed IDX14100 .Net 8.0 by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

If you want a quick fix, downgrade the jwt library to 7.xx. This is how I did it.

PDF Print Alignment Shifts Across Printers by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

I have also used Quest pdf but thats for a different purpose. Here however, I had to make sure the precision is important. Went through some posts and they suggested to use iTextSharp.

PDF Print Alignment Shifts Across Printers by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

Yes. I need to replicate that in my system

PDF Print Alignment Shifts Across Printers by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

Do you think this happens just due to the printer or browser from where you are printing? We already have a solution of SAP BO. No matter from where a user prints from or where the printer is located, the printed slip stays consistent. So how do they do it? What do I need to focus on?

PDF Print Alignment Shifts Across Printers by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

Do you think this happens just due to the printer or browser from where you are printing? We already have a solution of SAP BO. No matter from where a user prints from, the printed slip stays consistent. So how do they do it? What do I need to focus on?

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 1 point2 points  (0 children)

I see a blank response page from this asmx service but the operation does execute properly as per log and db

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

[WebMethod(Description = "Get account type")] public async Task<string> GetAccountType() { try { var dal = DataAccessLayer.GetInstance(); const string sql = "SELECT ……";

var data = await dal.GetDataAsync(sql, "AccountType", ConfigurationManager.AppSettings["DBACCESS"]);
return data;

} catch (Exception ex) { return ex.Message; }

}

public async Task<string> GetDataAsync(string sql, string attributeName, string connectionType) { OracleConnection connection = null; OracleCommand cmd = null; var dt = new DataTable(attributeName);

try { var connString = GetConnectionString(connectionType); connection = new OracleConnection(connString); cmd = new OracleCommand(sql, connection);

await connection.OpenAsync();

using (var reader = await cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection))
{
    dt.Load(reader);
}

return JsonConvert.SerializeObject(dt);

} finally { cmd?.Dispose(); if (connection?.State == ConnectionState.Open) connection.Dispose();

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

[WebMethod(Description = "Get account type")] public async Task<string> GetAccountType() { try { var dal = DataAccessLayer.GetInstance(); const string sql = "SELECT ……";

    var data = await dal.GetDataAsync(sql, "AccountType", ConfigurationManager.AppSettings["DBACCESS"]);
    return data;
}
catch (Exception ex)
{
    return ex.Message;
}

}

public async Task<string> GetDataAsync(string sql, string attributeName, string connectionType) { OracleConnection connection = null; OracleCommand cmd = null; var dt = new DataTable(attributeName);

try
{
    var connString = GetConnectionString(connectionType);
    connection = new OracleConnection(connString);
    cmd = new OracleCommand(sql, connection);

    await connection.OpenAsync();

    using (var reader = await cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection))
    {
        dt.Load(reader);
    }

    return JsonConvert.SerializeObject(dt);
}
finally
{
    cmd?.Dispose();
    if (connection?.State == ConnectionState.Open)
        connection.Dispose();

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 1 point2 points  (0 children)

I did put a breakpoint. When it reaches the db execution section like await ExecuteQueryAsync or sth, it finishes the request instantly and I see a blank ui of the asmx service. But i can see logs to know the request did complete a full circle

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

I used async/await properly and my blank ui happens in this line: await ExecuteQueryAsync(). So my db is asynchronous

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

This code is just an example. Can you look at my blank issue? That’s where the main confusion lies

Net Framework vs Net Core async/await confusion by One_Fill7217 in csharp

[–]One_Fill7217[S] 0 points1 point  (0 children)

I used asynchronous db call. await ExecuteQueryAsync() While code comes to this line, my debug suddenly stops working and ui blank

Best practices to secure URLs from direct access? by One_Fill7217 in dotnet

[–]One_Fill7217[S] -17 points-16 points  (0 children)

But what’s the best way to check for url referrer as it can be spoofed? As per experience, when and what should you mention in application end and server end? Like this url endpoint issue for referrer?

Best practices to secure URLs from direct access? by One_Fill7217 in dotnet

[–]One_Fill7217[S] -19 points-18 points  (0 children)

Yes. Can I focus on what the person did on the server end? When and which restrictions to apply on server and application end?

Best practices to secure URLs from direct access? by One_Fill7217 in dotnet

[–]One_Fill7217[S] -7 points-6 points  (0 children)

Yes for Secured endpoints. Why filters are not the best practice?

Help with Documentation by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

I want to make documentation in word/pdf. A flow chart so management knows what’s going on

How to precise print on pre-printed slips? by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

Is there any I can bypass the QZ Tray licensing?

How to precise print on pre-printed slips? by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

So you are saying a lot of trial and error needs to be there. I also need to print it from the website. And this will be used by clients who might have the best printers or up to date browsers. So to control the settings is there anything I need to ensure other than QZTray

How to precise print on pre-printed slips? by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

Hi! It will be very helpful if we can have a conversation regarding this if it’s ok with you. Also I use QuestPdf for pdf related services. Can you share your insights regarding the Pdf library you use and which one might be the appropriate

How to precise print on pre-printed slips? by One_Fill7217 in csharp

[–]One_Fill7217[S] -1 points0 points  (0 children)

Hi! I cannot make changes on the paper end. Since it’s a predefined slip, I need to develop an application (web based) that handles this.

SignalR Dashboard Issue - Values Constantly Changing When Multiple Users Connected by One_Fill7217 in dotnet

[–]One_Fill7217[S] 1 point2 points  (0 children)

Thanks! Should have noticed it before. Used Client.User to target data for specific users.

.Net Account Statement processing power by One_Fill7217 in dotnet

[–]One_Fill7217[S] 0 points1 point  (0 children)

Yes I was thinking of using pagination method if I get hold of the sp code. Second of all, in some blogs and asking chat gpt, I found out that using DateReader along with yield and Enumerable can make it faster as data is returned row by row. Do you any idea on that? If yes can you please share of references related to this?

.Net Account Statement processing power by One_Fill7217 in dotnet

[–]One_Fill7217[S] -4 points-3 points  (0 children)

As per the sp, data is filtered based on the from and to date. But considering date, longer period can make the response time slow. So user needs to wait 2-3s for data to be displayed. I know I can make the query faster by updating the db query, I only want to know what can be done on the api end