It's funny you should start with that, I was just looking at the possibility of Threading & ThreadPools, but that's not something I've ever dealt with, as I'm really a web developer. This is my first attempt at writing a winforms app and I think I've jumped in at the deep end! I guess it's going to be a steep learning curve from here on! At least someone else has confirmed one of the ideas I've had for it :) Thank you!
markymark82
Posts
-
C# .net mass emailer -
C# .net mass emailerI'm using the System.Net.Mail class, so it's entirely likely my question doesn't make sense. The sort of volume it could have to handle is up to around 80k messages + more as the list grows. Each email is customised to the address with individual tracking strings on the URLs etc. hence being provided 1 at a time from a stored procedure. Unfortunately, we are using authsmtp as our smtp server for improved deliverability, hence the limit to 5 connections at a time, and that can't be changed. I have observed that actually recycling the connections gives a very minimal speed improvement, so I'm prepared to overlook that if need be, but I'm unsure of how to restrict the number of smtp connections open at any 1 time, waiting to send the next email until the number of open connections drops to fewer than 5 again. I'm sure it must be fairly simple, and that I'm missing a key point somewhere, but as yet I've not found it. What has already been written for this task, initially started as a test, but it proved suitable for sending the few emails that it needed to, giving us the flexibility we needed, however, now that people have seen that it can be useful, they want to use it for higher volumes, so now I need to look at changing it and getting it right. Thanks for the reply :)
-
C# .net mass emailerHey guys, I'm just looking for someone to point me in the right direction here, not necessarily provide a solution.. I have been tasked with writing a lightweight program for sending out email newsletters. This in itself has been easy enough to do.. but obviously I want to be able to send to as many recipients as fast as is possible. At the moment my solution sends 1 email at a time (the to address is provided by a stored procedure that returns 1 at a time), but this is a little slow. Having looked into it a little bit, I know I can send up to 5 emails concurrently using my smtp server before they start being throttled, and that I should be recycling the connections rather than creating and dropping them each time. I have been trying to get my head round the problem and seem to have a mental block as to the best way to create these new connections and recycle them. Some pointers would be great if anyone can advise. Thank you!
-
WebMethod called from Javascript mis-behavingHey guys, Hoping someone might be able to shed some light on a problem I am currently having. I have a WebMethod being called by some javascript code, everything is working as it should, the WebMethod is a static string. I am writing the output (which contains a small amount of html) to a hyperlink on my page (I'm adding a product to a basket and updating the link to the basket with item total etc.). On my local dev machine, and on a staging version of the website (a copy of live) this all works nicely, the hyperlink shows what it is supposed to. But when put live, the WebMethod is called fine, and the output comes out in JSON format. This in itself I didn't think was a problem as I can just use jquery to parse the JSON, but it fails in firefox as being invalid JSON. What's even weirder is that when I created a 2nd test version of the page (a carbon copy, just with the name changed), that behaves perfectly on live, without the need for JSON parrsing. This isn't a problem in all browsers, IE, Chrome (release) and the latest Safari all pop the raw JSON in as the hyperlink text, Firefox (4) seems to parse it and shows the correct HTML. Can anyone think why it would behave differently between 2 identical pages, where only the name is slightly different, and what the best way to parse the JSON is when it is returned from the WebMethod. Does it have to come back as JSON, I know xml is an option but really I could do with just a string.. I tried clearing all of my temporary files, so I know it's not a caching issue. Live server (and the staging one too): Win Server 2003 IIS6 The website is .Net 3.5, C# Thanks in advance!
-
Don't mess with Steve's desk!This has to be one of my favourite pranks, always good for a new person in the office.. and it teaches a valuable lesson!
-
HttpException Path 'zGET' is forbidden. [modified]hmmm.. That's all we could find too.. I which case I guess I'll just ignore it for now, just a shame as it's about the only error we seem to be getting now days. Thanks for the input folks. Mark
-
HttpException Path 'zGET' is forbidden. [modified]I'd had a brief look into that, and have seen the solution is to add in a handler such as:
< add path="*" verb="OPTIONS" type="System.Web.DefaultHttpHandler" validate="true"/>
Obviously I'd need to change the verb OPTIONS to zGET, but all I've seen so far have been references to verbs used by webdav, which I confess I know nothing about. I have found no reference to this zGET though and am wondering what could be causing this request. I'm not keen on adding a handler for a verb I can't find any reference to, at least not until I know it's an innocent http request. Thanks for the link -
HttpException Path 'zGET' is forbidden. [modified]This is a strange one, I've found nothing on Google etc as yet... I'm finding an error in my error logs more and more frequently, it's an http exception with the error message: Exception message: Path 'zGET' is forbidden. It only seems to happen against images, and the first instance I've found of it is from back in mid march this year. It doesn't correspond with any changes on our web server as that hasn't been touched since before then (not even for critical updates.. but that's another issue I have altogether..) My first thought was that it was an actual permissions problem, as we've had that on another server, and resetting the permissions on the affected images did seem to solve the issue when we saw it first hand, however, I think it was a coincidence as the other logged errors weren't spotted by us and so resolved themselves. It's a windows 2003 server, iis6, website's .net 3.5 It doesn't seem to be browser specific, first one I found was for opera 9.23 on linux. But we ad it happening on chrome, IE9, IE8, FF 3.5 too.. Has anyone heard of anything like this before, it has me and my colleagues somewhat stumped at present. Thanks in advance for any help. Mark
modified on Tuesday, December 7, 2010 5:47 AM
-
Custom error pages .Net [modified]Hi ya, I have made them relative, but when the trailing / is on the end it thinks it's in a directory above where it is, and so the links fail. I even tried making the links server-side so that I can use href="~/Styles/StyleSheet.css" but the website thinks it is at root level, because that's where the 404 page is. When I view the source code for the page, the links appear as www.mysite.co.uk/afakedir/Styles/stylesheet.css it turns out it's not just the css and js files, but all other links have the fake directory appended to the beginning of it. (I hope that made sense...) It's left me very confused, I thought it was going to be very simple. Thanks for the advice :) Mark
-
Custom error pages .Net [modified]Hi all, I have a custom 404 error page for my site, it is an aspx page as it uses the master template to retain site navigation etc. I have configured the web.config file, and so all un-found pages redirect to my 404 page just fine, but for directories not found it doesn't work, which I get just fine. What I have done then is to change the error page that IIS serves up, telling it to point to my 404 page relative to the site root. This too works fine, but only for urls such as : www.mysite.co.uk/afakedir but for: www.mysite.co.uk/afakedir/ it screws up my links to js files and stylesheets etc. obviously because these are set to be relative to the path, which is changed when a trailing / is added. How do I get round this without putting in absolute links to my js and css files etc? They need to be relative as I don't want to be making changes between my development and live site and obviously the paths would be different. I'm sure i'm not the only person to have this problem, or have tried this, I just can't seem to find a solution that works all round. Any help would be appreciated, even just pointing me in the right direction :) --- What I forgot to mention is that I initially need this to work on iis6, but will need it to work on iis 7.5 also.. Many thanks.. Mark
modified on Tuesday, April 6, 2010 5:02 AM
-
Accessing WebUserControls and Webform propertiesHi all, I'm not sure if I'm heading in the right direction on this, if I'm making things over-complicated then please point it out and point me in the right direction! I'm writing a search filter for my website where people can refine their search results by adding/removing filters like on many other websites. Ebuyer.com springs to mind as a rough example of what I'm trying to achieve. I'm currently creating the filter list as a webusercontrol so that it can be added to more than one webform if required. I want it to interact with it's parent page by changing it's properties and running a couple of public methods (all on the parent page). How do I go about accessing the parent page properties etc? I have tried creating a reference to the page class in the webusercontrol, but it refuses to recognise it. I'm writing it in c#, does anyone have an example they could show me of how I should be doing it, I would greatly appreciate it, or at least a reference to a good comprehensive article, as so far what I have found has led me down dead ends. Any help would be appreciated. Thanks Mark
-
Application Variable dissappearingHello all, Not sure if anyone has seen or heard of this problem before, but it has me stumped and google has failed to help in my search for an answer so far... I am trying to use a couple of Application Variables on my site, but they keep disappearing. I am storing the values I want them to hold in a config table in an SQL Db, then on application start I fetch the config values and turn them into Application variables so that I don't need everyone connecting to the db each time they need to be used which is very frequently. I know making changes to the web.config file restarts the application, and that's not what's causing the problem. No class files are being changed or even pages updated, and yet the application variables just vanish, sometimes twice a day, sometimes once a week. I have written an admin page to reset the varibles so it can be done nice and quickly, but I can't seem to find out what the problem is, I only seem to get it on my live server, not my test one. it's a Win 2003 box and the sites .net 3.5 if that helps at all? Any help/advice would be appreciated. Thanks in advance mark
-
A simple composite controlHi, Thanks for the reply. Yes it was in the page load and even though I tried it on other events, I somehow never remembered to remove the onload version of the event, coupled with it not being in a (!Page.IsPostBack) block. Having done that, it works just fine. Thanks for pointing out the error, I'd spent so long looking for problems with the control, I didn't even think it could be with my page :doh: Thanks again Mark
-
A simple composite controlHi All, I'm tring to create a very simple composite control, consisting of a textbox and a label (and some html to style it..) I have created it and at first it seemed to work, but now it appears I have missed out something fundamental. I have a Text property in which I am setting the text property of the child text control and retreiving the same child property.
public string Text
{
get
{
EnsureChildControls();
return childTextBox.Text;
}
set
{
EnsureChildControls();
childTextBox.Text = value;
}
}This works fine, unless on loading the page containing the control, I assign some text to the Text property. The text I assign appears in the child textbox fine, but when edited and attemped to save, it loses the new child textbox value, and reverts to the Text property as it was set on page load (or any other event that I use to populate it). I'm guessing it's some kind of viewstate issue? Though this is the first time I have attempted a custom control of any sort and the help I've been looking up has led to me breaking it completely a number of time while trying various solutions. If anyone has any idea what the problem is, then I'd appreciate your help as I'm running out of time to spend on it and don't want to have to abandon it because of deadlines. Thanks in advance.. Mark
-
First Encounter with ASP.NETIf you want to use it throughout the company, and users are using desktop software, then obviously that software will need to be rolled out to all users who'll need it. It can then connect to various web services for updates etc. These web services could also be connected to by any other desktop (or even web) applications that you develop later on. A web application is more self contained (please people correct me if I'm being completely misleading), and so can be accessed only by itself. This would be centrally accessed by all users who wouldn't then need their desktop applications (these would be re-written as the web application). I hope that makes sense, and I'm not just confusing matters further
-
First Encounter with ASP.NETThat depends on what you're trying to acheive. If the users are going to continue using desktop apps then they'll want to update from a web service. If you're going to write entirely new project management software to be run on a network in a browser then you want a web application. That's how I would look at it.
-
how to send website visitors to a holding page if over a certain amountHi all, I'm looking at creating a system on our website to redirect abnormally large volumes of visitors to a holding page to limit the amount of bandwidth being used to keep our website working at a reasonable speed (The holding page would use virtually no bandwidth and would auto refresh to check if they can gain access yet or not). What I'm after is to say if there are more than say 800 connections to the website, those over the 800 get assigned a queue number and sent to a holding page until a connection is free. I had an idea to do it with Application variables and sessions, ie: on Session_Start Application["CurrentConnCount"] = itself + 1 on Session_End Application["CurrentConnCount"] = itself - 1 However, the Session_End event can't be relied upon to be fired if a session just times out. Is there another way I can do this, it all sounded nice and easy in my head, but the execution is currently eluding me. I know I can limit the number of connections using iis, but this returns 'Service is Unavailable' and does not care if someone is in the middle of a transaction or not so isn't suitable. Can I look at the number of current connections to the website using .net, rather than relying on events that may or may not be fired? Thanks in advance for any help, I hope that all made sense and I'm not talking complete jibberish...
-
"A validation error has occurred".... script attacks...Thanks very much, I really appreciate it. Mark
-
"A validation error has occurred".... script attacks...Ok, so I've added that to the click event of the psting button and also to the text_changed event of the offending textbox. But then I get another 3 attempts on it, how do I force the page to be loaded from the server rather than a cached version, and will that even work if the version being attacked is a cached version, that doesn't have code in it to prevent caching. this is so frustrating, yet it has that feeling that it must be something simple. I've found the following code to put in the page load event, that I think i'd need in the master page:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Will that make just the page always load from the server, or will all of the other objects on it (JS files, css, images etc.) be forced to load fresh aswell, I'd like these to stay cachable to reduce bandwidth. Thanks for all the help so far, much appreciated.
-
"A validation error has occurred".... script attacks...Excellent, I'll try that and see how it goes. It sounds like the kind of fix I'm looking for, cheers for the replies. Mark