How to create a dynamic image that updates when requested? - asp.net

So I'm trying to make my own forum signature generator for some friends, and I've gotten most of the work done. My real issue now is refreshing the information when the image is requested from my server.
I have almost no clue how to even go about it, so I'm sorry if my question is poorly written. Basically, I'm looking for someone to push me in the right direction on how to have the image refresh from the datasource when it gets requested, but only if it has been more than 5 minutes to prevent an overload.
Thank you. I'll post code here, as I try to make it work once I get my start.

You will have to create a new HTTP handler. Check out this msdn post.

Related

Long delay after button is clicked

I'm just learning ASP.NET using VB 2010, and although I've had a lot of good progress, I am stumped by one issue that I can't resolve. I've also the web for answers, but I haven't found anything that is exactly what I am dealing with. ...though I may not be using the correct search terms.
Anyway, this is an app that will run on our company internet site which requires users to enter information into text boxes and click a button to accept it. Then it will show a modal pop-up asking the user to confirm. The pop-up has a "Confirm" button and a "Cancel" Button. The cancel button works immediately (hides the confirmation pop-up), but the confirm button hangs up for several seconds before it moves to the next step, which is a modal "Thank You" pop-up. The Confirm button writes data to a database.
Now, that's how it works inside the development environment. However, when it's on the production server, it will sit there for who-knows-how-long before it does anything. I can tell that it is writing to the database, and then displaying the data on the page, but the Confirmation pop-up stays up, and the Thank You pop-up never shows up. Also, the app is supposed to send an email to the user as acknowledgement, but it doesn't do that.
When it hangs up like this, I have never waited long enough to see when it catches up. And when it's live like that, I don't know of a way to debug it.
More info about the page: There are several update panels, one that responds to a timer tick every second to update fields on the page. The others are set to "conditional," being updated by other events. For example, the Confirmation and Thank You modals are in conditional update panels which respond to different events.
So I have two questions: Can anyone advise me about the hangup, and is there a way to debug from a live site? Oh, and maybe a third: Can you have too many update panels?
Update: Follow up question: Can it be going off on a different thread, going off track from the correct thread? I've never really understood threading, but this seems like a possibility.
This could be any number of things, so it's going to probably be something you're going to need to dive into and troubleshoot and it's probably not something we'll be able to help with too much.
First, the obligatory request: please post your code :)
Now, something that works quickly and dev and slowly in production is usually a resource issue or a code/data issue. First, take a quick look at the server and make sure it's up to the task for multiple users and all of that. It's worth a quick look, but it's usually an issue with the code or data.
What is that update command doing? Is the SQL behind it written well and efficiently? Are there any database locks that might be happening where another user is doing something and your code is actually waiting for it to complete before doing the updating? How many rows are in the database / how many are being effected?
I'd start by running a SQL trace to see what's really happening and to get an ideas as to how many database calls there are an how long each one takes to execute. If that's not the answer, look at the VB code and see if it's efficiently written. If not, go back to the server resources. Without seeing any code or having any idea what the application is supposed to do, I'd bet on the database queries being the culprit.
My bad. I hadn't mentioned one aspect, because I had no idea it would be a factor, but it is. Part of the process was to log certain events into a log file. The way it's set up in our IIS, that's a big no-no. So it was throwing an error, but the error was only manifesting itself as a long delay. I commented out the code that opens, writes to, and closes the log file, and it's all good.

How do I Implement Globalization and Localization in ASP.NET

Suppose if someone opens my site from India it should show Indian time of if someone opens this site from US it should display their local time.
How can i do it.
Plz help me out
Thanks in advance
cpVariyani
Your question should provide more detail and describe what you have already tried.
The best/easiest way is javascript - good option that leads to what I might guess is a middle ground for you here: How to get client date and time in ASP.NET?
If you don't want to use javascript you can try and determine it from the request headers, but this is less likely to consistently work. Found this in an answer that strangely also linked the first link above: http://weblogs.asp.net/mikebosch/archive/2007/11/15/getting-the-client-browsers-date-and-time-with-asp-net.aspx

SynchronizerToken In ASP.Net

I was wondering if anyone can help me out. I have an application with several links. One thing I have been noticing is that when a user clicks a link more than once I can get a response multiple times. This may result in a record being committed to a database table multiple times and cannot happen. From what research I've done, it looks like this is an example of when I would use SynchronizerToken's but this is new to me and i have no experience using them. I did find this example: Button doing post back of one user
Is this method the best possible one to use for this scenario? I haven't really seen any other examples out there. Any help would be great.
Thanks
How about disabling the UI element right before postback so multiple clicks are not possible?
I ended up scrapping the idea of tokens and just disabled forms when a post back occurs.

FileUpload.HasFile always remain false(I am using Ajax)

I am writing one simple page in APS.Net with VB.Net as the scripting language. In this page I have two text boxes and relevant buttons to complete the job of taking input from the user.
The form prompts the user to enter an image title, image to upload(using ASP AjaxControlToolkit FileUpload control) and a list of search tags to research this image in the future.
I have researched for more than three hours and tried many different solutions posted online but still I am not able to fix the FileUpload.HasFile = False problem. This condition always remains false even after choosing the file to upload.
I understand that many similar questions have already been posted but I have tried those solutions and still I could not fix it.
It would be really great if someone could please help me with this.
I am using MS SQL database but I haven't done anything related to database in this page as I am not done with the validation and the input yet.
Please download the code files from:
http://www.mediafire.com/?ae1jq33zkj50tt7,olcmd5yct3tz52m,7lm3a9syplfdec6
Please let me know if you need anything else.
What u need is here! Checkout this , you may get some help from here.
mark this as answer if u like it. :)

How can I programmatically click the "Like" link on a Facebook status?

Alright, I fear I may be critiqued for this not being so much of a "programming" question, but I'll ask anyway. I don't do to much in web development-type stuff (OO is what I stick with mostly), so I'm not too keen on exactly how all this CSS, Javascript, SQL, etc works.
The problem: My friend has been trying to quit smoking for a while, but as many smokers do, he seems to only make it so far. He recently posted a status update saying if he had the moral support, he could do it. I simple want to create a link to the "Like" button. I then intend to write a script and simple message all his friends with the link. Is this possible?
Any tips in the right direction would be greatly appreciated. An explanation of how to do this would be divine. An explanation of why I can't do this would be met with a scowling acceptance and a thank-you.
For those who don't have a facebook, here are some pastebins. Anything else you need I'll try to supply
Pastebin of a my facebook.com/homepage page source:
http://paste.uni.cc/19860
Pastebin of his homepage as I see it page source:
http://paste.uni.cc/19860
His update to ctrl+F and see surrounding code:
"would quit smoking if he had the moral support."
Thing that looks to me like the css code for the "like" command
http://static.ak.fbcdn.net/rsrc.php/z2FUI/l/8fkujrwg/en_US/151675/css/like/like.css
Will this stop him from smoking? Most likely not, but it can't hurt. Worst case he'll just get a laugh and maybe feel a bit more inclined to drop the cigs.
Appreciate it as always.
The "Like link" is a Javascript-backed element which invokes an AJAX call to the server. It carries a unique ID which is keyed off both the item being "liked" and the user who pulled down the page (in this case, you) to ensure duplicate "likes" are not accidentally submitted and the UI to become out of sync with the DB; and to ensure you can't "like" something on another user's behalf. The case you are describing is indiscernible from a malicious attempt at doing the same thing.
Can you just send them a message with a link to the friend's page and tell them to "Like" the status themselves?
Why not write a Facebook application and plug directly into your own profile. You could invite his friends to your application, which would allow them to support your friend's attempt to quit smoking without having to hack together a script that "clicks" the Like link. The hack could easily be considered malicious.

Resources