Results 1 to 26 of 26

Thread: VB over web

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    VB over web

    I have an LINUX web server and am considering moving it to a Windows server.

    I've made some basic Desktop apps. can you make similar apps via ASP.NET using the same logic and controls.For example the timer control.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,352

    Re: VB over web

    Yes and no. Remember that the client and server are basically disconnected in web apps. You can use a JavaScript timer in a page to initiate an action at the client end, which might then make a request to the server. It really depends exactly what you're trying to do as to how much things need to change for the web.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    I guess a web based game!

    I need selected events to fire a selected intervals.

    I also want objects to update and change without reloading a page.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,352

    Re: VB over web

    Quote Originally Posted by ubkra View Post
    I need selected events to fire a selected intervals.
    I'm not sure what that means. Events occur when they occur. Like I said, you can use a timer in JavaScript if you want something to happen on the client side at an interval.
    Quote Originally Posted by ubkra View Post
    I also want objects to update and change without reloading a page.
    You'll be using JavaScript for that and you might look at using HTML 5 too. HTML 5 might include some timer-like functionality for certain things but I'm not sure. AJAX may also be of interest, which allows you to make a request to a server and update only part of the page with the result.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    Good point and let me clear up what I mean

    Can i have a timer and user the tick event to update my HTML?
    Can on a tick event I do other things such as redirect the page the user is on or load new content?

  6. #6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    Can that sit in the VB.NET code not JAVASCRIPT?

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,352

    Re: VB over web

    Quote Originally Posted by ubkra View Post
    Can that sit in the VB.NET code not JAVASCRIPT?
    Do you really think that I'd have stated three times in three posts that you would use a JavaScript timer if you could use a VB timer?

  9. #9
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    JS is a fine language - timers and events all over the place.

    Yes - can very easily have a function running on a timer that changes the HTML when the timer fires.

    And with AJAX you can send a POST to the server (passing whatever data you want from the page) - and the POST will automatically fire up a CALL BACK function when the server returns the data you requested.

    I have an entire user interface for maintaining records in a SQL database written in JS - page never reloads - I simply keep asking for more data with AJAX POST's and work up changes to the HTML with that data.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    Quote Originally Posted by jmcilhinney View Post
    Do you really think that I'd have stated three times in three posts that you would use a JavaScript timer if you could use a VB timer?
    So what's this???

    https://msdn.microsoft.com/en-us/lib...code-snippet-1

  11. #11
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    The "backend" timer control you mention is turned magically into a JavaScript action just like everything else is magically "expressed" in the browser window when the page is "created" by the ASP.Net engine.

    Do you know the difference between backend code and the front end JavaScript and how MS fakes it out so you think it's connected when it is obviously not?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  12. #12
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,606

    Re: VB over web

    To sum this up.
    PHP > asp.net server side (cuz php is better than asp.net)
    JS = JS.

    So php is server side and asp.net is server side but php is apple and asp.net is orange. Both fruits but different. It's like having Java language and trying to translate it to c# or vb.net
    Javascript is similar because it is a client side language, browser specific and browsers do not use php or asp.net on the client side.
    If you application uses entrirely javascript the it will play on an asp.net page javascript with a few modification (asp.net is , sort to say, used more like a notepad here rather that a programming language, in contrast to server side asp.net)..
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    Quote Originally Posted by szlamany View Post
    The "backend" timer control you mention is turned magically into a JavaScript action just like everything else is magically "expressed" in the browser window when the page is "created" by the ASP.Net engine.

    Do you know the difference between backend code and the front end JavaScript and how MS fakes it out so you think it's connected when it is obviously not?

    no i had no idea - so the vb code is just converted to JS at load time?

    Is JS a secure or safe code?

    I realise its not a 100% secure and banking websites would not ise it but is ot good use for an online game where you dont want people to "cheat"

    if not how can you overcome this?

  14. #14
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    It is not turned directly into JS at load time...

    If you setup a TIMER to re-display a section of the HTML that turns into a JS AJAX "timed" request - waiting for the interval to arrive - and then it POST's to the backend code to ask for a bit of data.

    Since the PAGE_LOAD event fires in the BACKEND you have to use a trick or two to know that it's a POSTBACK and not an INITIAL page request.

    IMO - those are crazy hacks that once you learn JS you can live without - ASP.Net is not doing anything really meaningful.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  15. #15
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,352

    Re: VB over web

    Quote Originally Posted by szlamany View Post
    It is not turned directly into JS at load time...

    If you setup a TIMER to re-display a section of the HTML that turns into a JS AJAX "timed" request - waiting for the interval to arrive - and then it POST's to the backend code to ask for a bit of data.

    Since the PAGE_LOAD event fires in the BACKEND you have to use a trick or two to know that it's a POSTBACK and not an INITIAL page request.

    IMO - those are crazy hacks that once you learn JS you can live without - ASP.Net is not doing anything really meaningful.
    Web Forms was created to make web development as much like Windows development as possible. I was originally a Windows Forms developer and when I started using Web Forms I absolutely hated it because the whole controls with events paradigm that worked so well in WinForms felt like a complete hack for the web, which it basically was. I only started enjoying ASP.NET development when I started using MVC. I would highly recommend that anyone wanting to use ASP.NET use MVC rather than Web Forms. There's a learning curve if you're coming from Windows development but the whole approach is much more natural for the web.

  16. #16
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    It felt like a complete hack to me to...

    I would suggest the OP research jQuery and AJAX and homegrown web methods.

    That way they can make sure that they need something like MVC.

    btw - JS and browser world can be secure - it's a matter of understanding the environment and how folks can exploit you. My web apps have been reviewed by security firms (at my customers request) - I'm happy I passed!

    The Bank of America web site I use for banking is totally secure - and it's JS.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    I've never heard of MVC!

    Quote Originally Posted by szlamany View Post
    btw - JS and browser world can be secure - it's a matter of understanding the environment and how folks can exploit you. My web apps have been reviewed by security firms (at my customers request) - I'm happy I passed!

    The Bank of America web site I use for banking is totally secure - and it's JS.
    How can it be secure when you can see and edit the JS code through developer tools?

    You can also turn off JS can't you?

  18. #18
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    You have to use HTTPS SSL secure sockets so you cannot be sniffed.

    You have to have some kind of security handshake - I use a GUID from the server that is returned after a successful username/password experience. Each subsequent AJAX call forwards that GUID to the server.

    Standard ASP.Net uses some kind of cookie and/or session values to make sure the client is a known entity and not some spoofer.

    If my users were to turn JS off they would not be able to maintain their databases - so they would not do that.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  19. #19

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    Say if I had an event fire ever 2 minutes - how can I get this time to not reset if a page is refreshed? (F5)

  20. #20
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    Refreshing a page can be stopped by a popup - I would recommend that.

    Otherwise the PAGE LOAD needs to know it's a re-load of the same user and tell that page the "trigger" time so the first interval can be closer to accurate.

    I would stop the refresh myself - a refresh is akin to stopping an executable and re-starting that executable.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    It's impossible to stop a refresh isn't it?

    What's stopping people coping the URL into another tab or navigating to another site and back again?

  22. #22
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    Stopping a re-load is simple - this very page you are on now will do it if you try to exit the page before POST'ing your reply.

    The ability to copy/paste into another browser window is not the same - right? That's like running the same executable twice.

    Although, you can "know" for certain that a copy/paste is a DIFFERENT session then the original - lots of tricks for doing that.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  23. #23

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    okay so

    1. How do i stop a reload?
    2. How do I stop multiple executable a single HTML file ASP.NET or PHP

  24. #24

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    423

    Re: VB over web

    duplicate tab function could be an issue.

    would love to know how to overcome that.

  25. #25
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    To stop a reload

    Code:
    window.onbeforeunload = function() {
        if (g_warning) {
            return 'You have made changes on this page that you have not yet confirmed.  If you navigate away from this page you will lose your unsaved changes';
        }
    };

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  26. #26
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: VB over web

    Opening a second window or second tab is a bit harder.

    First question - do you authenticate when you start your app so you know the username of the person on the other side of the browser?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width