Checking for form correctness in visual basic - asp.net

I'm developing a small web app using ASP.net/VB.net4 that contains an important form on one of the pages. I need to make sure that the form is filled out correctly, and have decided to go with custom logic to do this, writing each check by hand and checking every element on the page.
My question is actually more fundamental here -- I have the checks written to make sure that the form passes correctness, but I don't actually know in what programmatical structure to put these checks.
For now, I put the checks in an infinite loop in my Visual Basic code behind.
While (True)
If (...) Then
MsgBox("One or more of your phone numbers is improperly formatted. You will be given 20 seconds to correct this mistake. If the mistake is not corrected in 20 seconds, you will be eliminated. Good luck.")
ElseIf (...) Then
...............
Else
Exit While
End If
End While
Upon hitting the submit button, the loop activates and the checks are completed -- however, there is an issue with this method. When the form is not correct, then my alert message continues to pop up infinitely and does not allow the user to exit out. If anyone knows how to avoid this, that would be an appreciated place to start. Furthermore, the default alert box for VB.net is just ugly and unprofessional, I would prefer something in-browser if possible, rather than just an ugly Windows alert message box.
I've seen a lot of sites now going with a dynamic check; that is, as you fill out the form, if at any point your entry is not formatted properly or is incorrect, you get an automatic alert that tells you this and perhaps the text box color changes to red. I would like to do it this way, if possible, since this seems easier for the user. However, I do not know how to do this and have had trouble finding information online about how to implement this. I believe this is an example of AJAX/jQuery usage but it has been a while since I've used them.
This is a painfully common thing to have to do, forms logic that is. I know there are a million and a half ways to do this, but does anyone have any advice or recommendation on how to implement this? Should I be trying to use vb.net (code behind), javascript, or some other way?

Related

Editing the cooldowns of spells and spell like effects

I am trying to reduce the cooldown on the hearthstone and inscription research spell-like effects. I have identified the hearthstone item template and imported the hearthstone spell into spell_dbc. I have set the spell category cooldown to 1 second, but I am experiencing a strange issue. On use, the hearthstone is set to a 30-minute cooldown and not useable during this cooldown, but on logging out and logging back in, the correct cooldown is displayed and the item is useable once the cooldown has expired. I suspect that the client is tracking the cooldown of the hearthstone independently of the server. But I have no clue where to begin looking to fix this. Has anybody successfully made a change to spell cooldowns, and would you be willing to point me in the right direction?
Thank you!
Not a solution to your problem, but I'm pretty sure that what you are experiencing is actually an intended behavior to discourage hacking.
I think what is really going on is your login credentials are being used to create a secret that is then passed into the rest of their program, which is then used as a reference point for debugging.
Because they know the intended behavior of their own game, they can check to see if the results of arguments sent from your machine are within expected parameters.
And because your modifications fall outside of those parameters, what the developers decided to do was to change the cooldown to something sufficiently annoying to detect who keeps on manually logging out and logging back in again.
I studied programming in college, and I'm telling you that if you know enough to change the cooldowns locally, you should try doing something more productive. Either find another game to play at the same time, or just do something completely different from gaming altogether.
Hope somebody double checks what I have said here for accuracy, because I am curious to know if I am correct about my assessment.
The solution is to delete the client cache.

asp.net multiple user calculation error

Apologies if this has been asked/solved before. I've done a fair bit of searching but can't seem to find a direct answer to my problem.
I'm still very new to asp/vb coding.
I've created a complex calculator in asp.net using vb.net.
The user fills out a few text boxes with information then clicks the calculate button. The program then accesses an sql 2014 server to collect more information based on information the user has entered, then uses the information to run a few very complex calculations (I don't completely understand the calculations behind it).
It all works fine and is able to give the correct answer, the problem I've found is if there is more than one user accessing the site and they happen to click the calculate button within the same time, whoever clicked the calculate button first gets an error whilst the person who clicked second gets an answer.
I'm not sure if this is to do with how it accesses the sql database for information or if the information is somehow being overridden.
I was hoping this would be a common problem, but can't seem to find anything on it, at least I may not be asking the right question when searching.
Unfortunately for security reasons I'm not able to post any code for it (I'll see if I can get permission) but am hoping that someone has come across something similar and knows a work around. Maybe to have the site wait until the first round of calculations is complete before initiating the second round?
Thanks for your help in advance!
Please make sure that you should not use any shared variable in calculation because shared variables are common for all users. Also check for application variables.
I can understand, but if those public variable's value changed at one place, then after everywhere that variable's value will be new even if you are in middle of some processing.

Input saves as you type to collection - how to update UI?

First - I am having a hard time formulating this question, so please bear with me, and ask for clarification and I'll try to provide as much as I can. I am just starting to learn meteor, so be patient please.
I have several inputs that save immediately as people type on them. (with a slight 300 ms delay to not overload database).
Basically, on "keyup" it goes and saves. All that works fine. However, I'd like to add a visual indicator (say a green checkmark, or a tiny "saved") when the database actually stores what they typed.
Graphically:
[___________________]
[Typed something_____] (saved)
[___________________]
I am not sure how to go about this, but it's something common, that plenty of you have already done. If I didn't care about the database feedback, I'd just use JQuery, target a class beside the input and make the checkmark or word visible after a keyup, or add it to the DOM. Fairly straight forward.The only when I am sure it has been stored in Mongodb part confuses me.
Any help would be gladly appreciated.
Thank you
Addendum with code:
Template.dibs.events({
'keyup input.name': _.throttle(function(event) {
Dibs.update(this._id, {$set: {name: event.target.value}});
$(':focus + .glyphicon-ok').css('opacity',1);
}, 300),
Can you explain where/how you would add the code? (For spinner, or the words).
Coming from JQuery I did something that I know is not the right way. This is in the client portion (I know just demo code, and it's not secure) but I wanted to know the best way leveraging meteor to do it. I already have checkmarks stating it was saved in the page, but they are all hidden, this code just makes them visible on keyup for the field.
I read through the article, and didn't quite see how I'd go about doing the intermediate step (spinner or the like) then the finalized checkmark after code is saved. I've also being going through the new 1.0 tutorial (which is great) but I'm still missing the visual indicators. It's great that meteor updates the UI if it fails in the server to reflect that it didn't save, since I am assuming success, I don't think that tapping into the Meteor.Error makes sense. Should there not be a Meteor.Success or equivalent?
Again, I apologize for the long message, I'm trying to wrap my head around this, because the technology looks very promising
Welcome to Meteor! Meteor was in fact designed (among other things) to handle just this type of situation, via a mechanism called Latency Compensation. You can read more about it at Meteor.methods.
Calling a method on the server requires a round-trip over the network. It would be really frustrating if users had to wait a whole second to see their comment show up due to this delay. That's why Meteor has a feature called method stubs. If you define a method on the client with the same name as a server method, Meteor will run it to attempt to predict the outcome of the server method. When the code on the server actually finishes, the prediction generated on the client will be replaced with the actual outcome of the server method.
You can use Latency Compensation by defining a Meteor method to save the input text to the database, with a client stub that displays a spinner instead of "saved", and "saved" when its callback is called successfully.
Alternatively, you can call the update method on the collection directly, and add a callback on the client, which will be called with (error, numberOfDocsUpdated) after the server method returns.
Read more on when to use Meteor methods and when to use client-side operations.
As Dan has said, the Latency Comp takes care of needing to do this. Another way of doing this is in a template event. You can set a session variable on keyup with the contents of the text field and in the helper, set a flag that will render the checkmark when the session variable and current user input matches.

ASP.NET AJAX Progress Indication with Async Server Calls

I know this question has been asked before..a lot in fact. But I can't seem to get the wheels turning on this thing. To be honest I'm a bit lost on mating client side and server scripting and the examples I've seen are either far to simplistic or way above my head.
Goal:
My goal is to take a long running process I've writtin in VB.NET on the server, which happens to be loop based, and calculate a percentage complete (I know the range of the index values) and relay that back to the user by some means.
Idea:
As the loop iterates I want to pass back up to the client an integer of percent complete or poll it from the client.
What I've done:
Is very limited, I have little to no experience here, I've been doing a lot of googling and I've played with the UpdatePanel and UpdateProgress controls from AJAX a bit, but this method so far seems to lean towards an idicator, like GIF.
As always any help is appreciated, and if I can answer any questions I will.
Have you considered using an inline frame (iFrame) to host your long running process and report back status to the client via the Response object of the long running .aspx page?
If so, then I suggest you read Easy incremental status updates for long requests.
The example uses a button as the display for the progress after the user clicks it, but you could direct output to another DOM element if you wish.

Paypal Button creation/encryption

I've search for this online but couldn't find anything conclusive, yet.
I wish to make a large (yet unknown) number of paypal buttons, different prices, currencies, etc.
I have been following the encryption methodology and I came to a stop/point of additional research when I discovered that each encrypted button must be created on the command line and copied to my website.
This doesn't seem feasible if I require a large number of buttons, and due to this (apparent) absurdity I feel that I must be missing something obvious? Some sites have 100s/1000s of different prices/buttons which must be dynamically created.
Or is the correct procedure to leave the buttons unencrypted, thus dynamically created, and then use the IPN Listener to validate payments?
I'd be happy if someone could just point me towards a few tutorials/webpages.
Thank-you kindly for the help
Joseph
This will give you a start:
https://www.paypal.com/us/cgi-bin/webscr?cmd=_pdn_xclick_techview_outside
I use custom created buttons all the time.

Resources