Sync website browsing to another machine? - c#

Is it possible to have a website displayed on two seperate machines but to syncronise the users input on either machine to the other?
Basically any anchor clicks, image zooms, javascript pop out menus etc need to also occur on the other users screen and vice versa.
In my case the site will be developed in c#.NET but how would one approach something like this, would you use javascript or a database or some other method?

Having spent a long time looking into this I've found a solution, SignalR - http://signalr.net/ for ASP.NET allows you to do exactly what I require, I won't go into detail here as the post would become huge but for anyone wanting to do the same in future then visit http://signalr.net/ and have a read, it's amazing technology!

Related

When to use javascript instead of creating an aspx page?

I am new at C#.Net and i have one question that i couldn't manage to find on the internet. When should i use a classic combination of html + javascript + css instead of using an aspx page with a code behind?
As i experienced since i started .net , i found that aspx pages and code behind is a huge ease for developers. I didnt need any piece of javascript code since i started. There must be something wrong. I think i am missing a point. Can you answer my question and tell me some examples that i must use html+javascript+css instead of aspx + aspx.cs or vice versa??
Have a nice day.
Javascript is a client side technology, running only in the browser, whereas ASP.NET runs on the server side. These allow you to achieve different and complementary things.
With a classic server side language, any user interaction that you want to respond to must typically be posted across the internet from the browser to your server. It is then processed by the server, which responds with a new page for the browser to load. This generally means that the response time for the user is slower, though you will have access to a much richer programming environment on the server.
With a client side language, everything is processed on the browser. This allows for faster feedback to the user, though at the expense of working within the much more restricted programming environment that the browser gives you, and with no access to stuff your application may depend on, such as your database.
Of course, the lines are blurred somewhat when you make an AJAX request (usually a call written in Javascript that makes a request to the server, receives the response, and updates the page dynamically).
You mention that you have not used any Javascript so far. Perhaps as a starting point you'd like to investigate validating user input on the client side? This way, errors are caught and reported to the user immediately without the cost of the round trip to the server. http://www.tizag.com/javascriptT/javascriptform.php
Both client side and server side technologies can be powerful and useful. Use a combination of them both to give the best experience for the user.
In my experience, using Javascript/jQuery in .NET has been for UI and client-side validation purposes. If you are building an app that does not require Javascript to meet your client's requirements, then take advantage of what .NET has to offer. However, implementing Javascript is not that hard, so feel free to use what you prefer and is in the best interest of the client. You can still write and use Javascript in an ASPX page.
One of your considerations might well be speed. Javascript in a web-page will run on a site visitor's browser. Code-behind runs on the server hosting the page.
from my experience the main aim to use the companion of html,css,javascript with asp.net when the client needs is for a web app that acts exactly like win app
that u don't need to flush over the page to the server and come back again
Points you are missing
Code behind is not what makes ASP.NET; you can make a web app with all C# code right into the aspx files.
If you choose ASP.NET and C# for a web app, all your pages should be aspx ones, except for very specific and not very common situations.
You need to understand the difference between server side scripting and client side scripting. ASP.NET is a server side scripting technology while javascript is a client side only one. Take a look.
You can create aspx pages that are as simple as you want -even without any relevant serverside scripting- and thats all right.
Attempt to answer
You use the word must, so:
You must use aspx instead of only javascript if you want any kind of server side processing.
You must use an html file with plain javascript, jquery and css if there is the specific requeriment to do so, wich would be very uncommon. That could be a situation where a) the page should be as fast as it can possible be b) you don't mind everyone to be able to see your full code by just selecting view source on the browser c) there is no need at all for server side processing d) you don't mind about the little extra mix of technologies on your web application.
You use Javascript/JQuery to perform operations that does not need any server side processing like validating controls for a range or for empty values, some fancy UI stuff. It is much faster than the code behind because it does not post back to server however you could use UpdatePanel aspx server control to have partial post back and avoid reloading the page.
As a web developer you should always use combination of server-side processing and client-side processing. Working logic and application processes on the client-side allows browser based applications to seem more responsive and to have more "snappiness" to them.
If you are looking for highly customizable and high performance pages, then I would go with html + javascript + css and make calls to some webservice. This way you are not restricted by asp.net controls. Also, there are a lot of caveats with standard out of the box web forms that can lead to page performance issues and overhead - ViewState being one. You can also design your own asp.net controls as well, but there is some learning curve.
It really boils down to personal preference (there isn't anything in one that you can't do in the other) : Fundamentals vs Abstraction. To me javascript has always felt somewhat cumbersome when used in conjunction with webforms, however, with mvc it is a lot more natural, as it would be with a standard html + javascript + css page.
When you want to create static pages you can use html+css+javascript instead aspx.
In case you want things more dynamic you have to use aspx with cs.
For more info go http://www.w3schools.com/aspnet/aspnet_pages.asp

Adding a re-usable 'box' to my asp.net web app

I'm building a basic web application in ASP.NET 4.0 with C# in Visual Studio 2010 Pro. I'm still very new to C#, and am used to Delphi coding. My website already has registration/login, and although I use some asp.net controls, a majority of my pages are dynamically loaded from my SQL database and I manually compile the HTML code from C# and insert it into the document.
Now what I would like to do is implement a poll - or a vote box - an 'object' which can be re-used in different pages. My website's master page already has a permanent left panel which has things which show on every page. One of these will be a small box with a vote of a few questions.
All I need to know is how do I begin to build an independent plugin control for a web page like this? I don't necessarily mean a separate DLL or anything, my existing one can handle everything. But I'd like to re-use the same little voting box in different pages too. So I'm assuming this will be considered a separate page, in a way, which is probably about 120 pixels wide by 80 high. Each vote will be limited to either login account or ip address (which I already have access to). So this solution must interact with the existing asp.net application.
So how do I begin the 'backbone' of such a plugin which can be re-used in multiple pages? I do not plan on distributing this plugin, and I don't even know if this is the correct term for what I need. Just a 'box' which can be 're-used' on multiple pages - which must interact with the asp.net app.
To better explain what I mean, imagine how Facebook has the plugin where you can embed some general info about likes and such. I'd like to make my own box like this - and even be able to embed it in other websites.
It sounds like you just need to make the poll into a user control. The documentation should get you started with them. A control can access everything an ASP.NET page can when it comes to the login information. It won't handle embedding into other pages though – embeddable active content that authenticates against your site is a nontrivial problem.
As I said in the comment, if most of your HTML is creates as a blob that's opaque to ASP.NET, it will probably be nontrivial to insert a user control into the middle of it.

Multiple page form in asp.net 3.5

I am trying to design a multiple page web form to collect information from the users. Users can quit at any time and then come back later on the page where they left, I send an email to users containing a link back to their application when they start application process. I am wondering if I can do this with asp:wizard? Does anyone know whether I can use asp:wizard to start from a page where user has left along lets assume 3rd page with their filled data and also when they click back, they should be taken to the prev. page i.e. 2nd page.
I think this is not a good approach. There must be some alternative, that you must try. Nut If this is your requirement, then you might face issues like this
You need to maintain a database of the anonymous users or the users that are using the wizard. Result waste of database sapce.
How would you define that the returning user is the same genuine user , not some bot or hacker. As this might leads make data public. For example you are Akshay , you filled up to wiz#2 and quit. Now next day you want to complete the form. How the system will know u r Akshay Kumar not Sunil Shetty. Also if some Jhonny Lever come and might take a hit and trial on Akshay , then he will get you.
So take a deep thought on the issue and discuss with the seniors regarding the alternatives, also there are lots of SO Guru, which will definitely suggest you some good way out.
I am not using Wizard anymore, but it is possible to go back to any step of the form wizard by using Wizard.MoveTo method. see here

How to show the list of recently visited web pages as chrome does

I would like to display the list of recently accessed/visited web pages just as google chrome shows. I want to achieve this using C# and asp.net.
I am working on a site where the user can see the list of pages that they have visited, I tried using iframe but that does not work as per expectation. I am looking for a clean and intuitive interface something like google chrome.
I would like to provide a thumbnail view of the recently visited pages.
To keep my question simple, I want to display a list of urls as thumbnails, just as chrome does
Note that Chrome can do it easy, as they get to render the page and can take a bitmap snapshot of it easily to show for the thumbnails. (These are not live websites in there)
If you want to do the same thing, you have to render the website offscreen and take a snapshot to show to the user.
If you want to actually show a live website - now that's another story. There are a lot of sites that don't like being shown in the context of another website (for whatever reasons - security, marketing and so on) and will employ any tricks (including legal) to make sure this does not happen.
Pages only visited within your own app?
There are several components that will alow for that using their api. For example:
http://www.tonec.com/products/wssh/index.html
You can just take a snapshot after the DOM for tha page is completely generated and save the output using the tool on peruser basis.
Now, if you want something more generic that works for any web site, you'd probably want to go with a web browser plugin.
Here would be a possible solution, although I've not tried it personally:
Keep a record of all the pages that a user visits (e.g. in a database)
When the user visits a landing page on your site, you could call the WebBrowser.DrawToBitmap function to render a bitmap of each page they have visited recently.
Please note: this is just a theory, I'm not saying it will work! ;)
This link might help you get started:
http://pietschsoft.com/post/2008/07/c-generate-webpage-thumbmail-screenshot-image.aspx

I'm about to start using ASP.NET MVC2 for my web application

I have a pretty big web application that I created last year using ASP.NET webforms. It has two parts: Admin and Client (each one a project inside a single solution). Admin logs in as you would expect and manages the clients. Clients log in and manage themselves. SQL Server back end. It relies heavily on MasterPages and LINQ. It has 2 class libraries, one for my methods (authentication, security, encryption, etc.) and another with dbml files for linq that both admin and client project reference.
Now I really want to convert this to MVC 2. I know I'll have to rewrite the front end (not a problem, looking forward to it). I can reference my current class libraries and modify them as I need. My main concerns are my forms and controls. I'd really like to stay away from the major asp controls and use jquery for everything if possible (especially the presentation layer. I'm just not sure how to go about doing this. I was also told jquery is great for 'parsing and updating the DOM' but I've never done this either and not sure where to start (why do this over LINQ?).
Another issue I struggled with was the size of my main table. It has 109 fields in it, and my customer thinks all of them need to be available on screen (or as many as possible, especially in the grid). I had to break up my entry/edit form into 5 tabs (all web controls). My grids have sorting, grouping, export to excel, etc... I would really like to find a grid that lets you inline edit individual cells when double clicked. Would it be better to use jquery for grids? I can break that large table into relational tables if needed (probably will do that anyway).
Any advice from anyone who's done similar will be greatly appreciated. I just bought the book "Pro ASP.NET MVC 2 Framework, Second Edition" and I have a great jQuery ebook I'm working with.
Thank you guys!
EDIT: Should have mentioned I used Telerik WebControls for my previous web forms project so I'm familiar with them. I had no idea their MVC suite was free (I've paid quite a bit for the webform controls).
For grids I can recommend the free Telerik mvc controls. They have good support for ajax binding paging, sort, edit, parent-child etc.
This combined with a few widgets from jQuery ui (tabs, dialog) should put you on the right track as far as your presentation layer is concerned.
Adding to RedSquare, the Telerik Extensions for ASP.NET MVC are free and open source (under GPLv2). That essentially means the Extensions for free for "free" projects (projects you're not trying to sell). If you're trying to sell and make money from your software, we have a commercial license, too, to support that.
Today, the Extensions for MVC include 8 extensions: Grid, Calendar, DatePicker, Menu, NumericTextBox, PanelBar, TabStrip, and TreeView.
Additionally, 3 new Extensions are available in beta: Editor, ComboBox, and Window. (Official release towards the end of August.)
The goal of the Extensions is to make it easier to build rich MVC Views, similar to what you've done in the past in WebForms. MVC is very different than WebForms, though, so be careful when making the transition to avoid the "traps" of thinking in WebForms mode. For example, there are no PostBacks or ViewState in MVC, so some things require more deliberate code in MVC.
Finally, as a word of caution for "pure" JavaScript components, remember that they do not support any scenario where JavaScript is disable or not executed (common examples: web crawlers, accessible browsers). If accessibility or SEO are concerns, Server + Client UI controls like the Telerik Extensions can be a bonus.
Hope that helps.

Categories