Static pages (.html) vs ASP.NET pages (.aspx) [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
we are going to develop a media website where we will show current news.
For that we have 2 strategies:
Create window service in C# which will generate static (.html) pages for website (with updated news) as there will be only images and text (no postback or server-side event required) on website and then service will upload affected pages on server.
Create application in ASP.NET (.NET Framework 4.0) and use output caching for few minutes in it (as news updates in every 2-3 minutes).
Please suggest which one from above will be more preferable from performance (or other) point of view in my situation.
Please also suggest if any other strategy may provide me better solution. Thanks.

Making static pages will also prevents user to wait until new page is generated on server,so there is no way,only html can understand either new page or itself is generated again.This will cause user to make an interaction with the page (refresh) to find new results,so the cycle ends.You cannot expect user to know when content is changed.
As long as the content is dynamic in time interval,you should prefer asp.net solution with AJAX requests.You can make this with single page.
DO NOT FORGET that either developing via HTML or aspx or any kind will display your results in HTML output,so unless your page shall use any server content,try asp.net dynamically.
I can also assist code,please verify the specs.
Best Regards

Second one will be nice method
Problem with the first method:
HTML page want to be created each time
Created HTML pages what to be deleted or overwritten each time
Whole page want to be recreated (by using AJAX update can be done faster)
so comparatively second one is the right method.

Related

Use Angular with an existing Asp.Net Website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on a project where we already have an existing website built using Asp.Net. We are planning to add some new pages and update some existing one.
I am planning to develop those new pages in Angular 5 with Webpack. We can not convert the whole website into Angular due to budget constraint but ultimate goal is to convert in completely in Angular 5.
Have anyone worked on such a hybrid app in recent future?
Can someone please throw some light on it, whether it is workable and If there is any performance impact due to mixing up the technologies.
Yes I'm working in a similar situation, and it's definitely possible. An .NET page (MVC?) can return an Angular SPA and take control of the UI flow from that point on.
Say you want to start by creating a "User Profile" page in Angular. When the user navigates to that page in your standard MVC site, it should return the page with the Angular application loaded (as a javascript script reference). From there on, the Angular app can handle further redirects and logic.
It does make some things complicated, but it's usually not feasible to port things in one go. This approach has allowed us to move over to Angular, 1 page at a time.
We at a large company have done exactly that. It is very simple. Using angular-cli create a new project
ng new my-project
and copy the contents into the root of your existing ASP.NET solution. You will now need to use
ng build --watch
instead of
ng serve
and copy the script includes from /dist/index.html into your aspx or cshtml file.

Should I return only Json Objects from controller to view? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm making an intranet website using Active Directory. I just realized that I didn't think about the work load that the server or client would have to do (I never really had this kind of issue since this is my first big website, and my first internship). As I use ASP.NET MVC, I have sent objects through my models, and used these objects in controllers to pass them to my views. Sometimes I send back a list of objects that can be pretty big.
I read on SO that using Json objects significantly diminishes object size, so should I do that when my controller or model sends an object?
Thanks for your help.
MVC doesn't return "objects", it returns HTTP responses.
If you mean you want to consider populating a page using JSON data obtained from an API method (either from Web API or MVC itself), then yes, that will generally require fewer bytes to be transferred than, say, a full-blown HTML page containing the same information wrapped in HTML tags.
But that requires an entirely different approach to how you set up your application. Instead of populating an HTML page serverside and sending that to the client, you populate the HTML page clientside with data obtained through an AJAX call, for example through AngularJS.
In the end you may be able to shave off a few bits, but it'll require you to move your databinding code from your CSHtml view to HTML+JS. It's up to you to determine whether the minimal (you mention intranet, so bandwidth will be less of a problem) performance gain will be worth the increased development time.

Large UL LI html file loading very slow [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a 'menu' HTML page. The Menu contains Book names and its chapters. It is designed like a tree like structure, built using tags UL & LI. The file is 2.6mb. The file is loading very slow on to the website. Are there any suggestions to improve its load time. Thank you.
One suggestion would be to only load the data that is visible to user and defer the loading of the rest to later time using ajax if that is possible.
Basically you load the top level items, then on click of any menu item you can make an ajax call to load it's children dynamically.
This is a very broad question to ask, without seeing the HTML or a representation there's no good way to answer this.
However, I can give some pointers:
check that compression is enabled for the website, or at least this
page.
simplify the structure check that the page has a good cache
header, so the client doesn't need to download it regularly
consider
using a dynamic page (json/jquery) that only loads the content of the
segment when it's clicked on. (as TeaCode suggests)
You mention C# and HTML5 in your tags, is this file auto-generated by a site?

Configure WebClient to speed up download [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What I am doing
I am trying to migrate Classic Asp app to ASP.NET MVC. Classic App was written for 15 years. There are no chance to write new project and migrate all code at one moment. Business app must work 24/7.
What solutions I have found
I did not find any good solution. One advice I have found starts with words "I feel your pain, bro". Business can not give such human resources for global refactoring. So the only way I found is to write some kind of proxy using WebClient.
Architecture
I have server with IIS that hosts Classic ASP app. I will add MVC app near it. Every request received by server will be managed by MVC project. If there is action that request asks - MVC app will work as normal. Render view, return to client. If there is no such action Controller will call Classic ASP by using HandleUnknownAction method.
So it will do some work by processing url and cookies and in the end call Classic Asp app by WebClient.DownloadString(). The return string (HTML response) it will embed as content to the page (Headers, Footers are in MVC Layout). Need to mention - project is not highlighted but near it.
So I can migrate old code by small pieces. Action by action with no impact on application. Just by creating action methods in MVC.
Requirements
Response time will grow significantly.
There are no alternatives.
Question
I want to know every possible chance to speed up such web app. Maybe by tweaking WebClient configuration or so. Are there any settings to do this? Maybe some advices to manage webclient pool? I do not need to make cross server requests - does this open any abilities? Maybe this is the place for async calls? Or reorganize server structure?
Thanks for any advice!

Can Page.IsPostBack property be used in Windows forms?? c# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Hi guys I am trying to use the "Page.IsPostBack" in my windows form project. I am aware that this can be used on web pages but can it be used in windows forms as well?
if so will I need to import anything?
No, those are two completely different paradigms. IsPostBack is meant for stateless programming, whereas windows forms is stateful.
Nope. Postbacks are used in web forms. .IsPostBack is not a member of windows forms so there is no way to use it.
Simplified summary:
WebForms needs the IsPostBack property because the form is loaded every time it posts back (traditionally this was anytime a button was pressed, though now AJAX changes that a bit). Because it stored a serialised version of all data in ViewState, you didn't want to reload the data in a lot of cases (this proved to be a huge issue as ViewState massively increased the page data, something for another topic).
WinForms only needs the OnLoad() handler, as the form is loaded once and stays on screen, no matter how many times a button is clicked. You can close and re-open the form, but it is valid to reload the data in that scenario. In your OnClick handler you can decide if/when to reload any data as required.

Categories

Resources