Response.Redirect Is Losing My Session Variables
May 28th, 2008
RHOH10721..or so I thought. I spent several hours today researching a problem where after submitting my edit.aspx page I would be forced to log in to my admin site again. I was clearly losing my session variable that stored my log in status. Since this was only happening during a delete data function I thought I had tracked it down to the response.redirect statement. I found several threads and blogs that indicated that I was correct in assuming that it was the response.redirect problem. They all had a simply solution - to simply use the overloaded version of Redirect:
Response.Redirect(”~/default.aspx”, false);
Of course this simple solution did not work for me. I spent a very frustrating hour researching and testing code changes before coming to the conclusion that it was not the Response.Redirect statement. So I starting researching other possible causes. After looking at my code again I noticed that the biggest difference between the edit function and the delete function was that in the delete I was doing a Directory.Delete statement to delete uploaded documents. So after a little more research I came across this article http://www.vikramlakhotia.com/Deleting_Directory_in_ASPnet_20.aspx . Apparently in ASP.Net 2.0 when you delete a directory that is in your root web directory the File Change Notifications (FCN) will cause the AppDomain to restart thus losing all your session variables.
Great I had another possible cause but now I needed a solution. I didn’t like the solution presented in the article which was to just delete the files. Another posting I found suggested marking the directory in some way and then run a scheduled job to deleted the flagged directories - but that wouldn’t work for me either. Another suggestion was to move the directory outside of the web root - again not a possibilty in my situation. So my search continued until I found this vb.net code that would turn off the FCN monitoring from the root website directory, but monitoring of Bin, App_Themes and other folders will still be operational, so updated DLLs will still auto deploy.
Dim p As System.Reflection.PropertyInfo
Dim o As Object
Dim m As System.Reflection.MethodInfo
p = GetType(System.Web.HttpRuntime).GetProperty(”FileChangesMonitor”, System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)
o = p.GetValue(Nothing, Nothing)
m = o.GetType().GetMethod(”Stop”, System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic)
m.Invoke(o, New Object() {})
All I had to do was add the above code into the Global.asax in the Application_Start section. Simple as that and had I not been so sure that it was a response.redirect issue I wouldn’t have spent a whole morning researching the wrong problem.
Hosting Recommendation | Learn from Our Experience
April 7th, 2008
JUST8660Ok, so over the years we have discovered some really great and some really not so great hosts. So the question always comes up “Who should we use for hosting?”. We have prepared a brief synopsis of the best and worst hosts in a couple different scenarios.
SHARED LINUX HOSTING
If you are looking for SHARED LINUX HOSTING you cannot beat Bluehost and the one you absolutely do not want to use is Avahost and trust us, this is from years of experience. Avahost overloads their servers with too many sites and your site and your e-mail will constantly be jammed up. On a side note, we have never used the Shared Services with SagoNet, www.sagonet.com , but the service with SagoNet is AWESOME on everything we have ever hosted with them and we are confident that this would not be any different.
VIRTUAL PRIVATE SERVER (VPS Hosting)
Mainly our hosting here at Override involves large scale projects on a minimum of a Dedicated Server but the few times we have used VPS we have had good service from Full Control at www.fullcontrol.net . Generally we steer clear of the VPS plans because it never seems to bridge the gap between Shared and Dedicated in the right capacity.
DEDICATED HOSTING
This is the bread and butter here at Override as we specialize in large projects that require massive server resources and complete control over the server. For a Dedicated or Co-location Package you cannot beat the price or service at SagoNetworks, www.sagonet.com . We have several large clients sitting over there and are pushing more there everyday. For dedicated steer clear of 1and1. While they are great for Windows Shared Hosting they do not harden their servers and the response times are very slow. Also, they have some things that you have to call for that should be considered standard. For instance, they do not open port 80 on their firewall by default so you will have to call just to be able to view your site on the web.
We hope this helps someone out there, feel free to contact us with any questions!
eComm :: When to Go Custom ::
February 15th, 2008
JUST8660There are clearly myriad “Out of the Box” eCommerce Systems out there and there are also ones on the web that are charging their clients a fee each month for a Template Site that looks like many others out there. This makes it difficult for Web Development Firms to tell their clients that they need a Custom eCommerce Solution in most cases but we at Override have found it to be much more cost effective in many instances to go the Custom Route and have seen our Customers be much more satisfied as well as receive a much higher Return on Investment.
So how do you decide first of all WHEN it is appropriate to go custom and then finally HOW to convince your client that custom is the way to go?
The first thing you need to do is be very aware of the different systems out there. There are several good ones out there ranging from the simple SimpleCart to ZenCart and our two favorite are osCommerce on the PHP Side and ASPDOTNETSTOREFRONT on the ASP.NET side. Each product has its benefits and drawbacks and knowing the ins and outs of as many systems as possible always gives you and your client the best chance at making the best decision. For example osCommerce is a system that is difficult to achieve a TRULY custom look even with the use of the STS Skinning Engine. It is possible and you can see an example of one that we have done with this at www.cuprock.net however most of the functionality you would want to use is built right in. On the ASP.NET side ASPDOTNETSTOREFRONT is fairly easy to modify the look with the use of MASTER pages; however, you are stuck with generating XML on the fly in order to pull back datasets in a custom way not to mention the fact that this product is not open source nor is it FREE, prepare yourself for about $1,000 just to use it. The administrative panel is however VERY powerful.
So with all these alternatives out there how do you know when to go Custom? It is very simple, evaluate! Figure out how much time it will take to make any necessary modifications to either the look or the functionality of the “Out of the Box” system and bounce it against your Custom development costs. Without having to work within the limitations or boundaries of an Out of the Box system, especially if you are not familiar with what they are, more often than naught you will find that Custom wins and fits the Business needs of your client perfectly!
Hope this has provided some insight!
Kind regards,
JT
Generating Revenue on the Internet
January 26th, 2008
JUST8660Clients often have great ideas that will make a great web-site or a great web application. We see all kinds of ideas come through our office of web applications that would offer users a web experience that they would enjoy and benefit from. The problem is that often then have not thought their solution all the way through and when we get to the question of “How are you going to generate revenue from this?”, they often have not thought of an answer as if they thought at the end of every month they would receive a check from “The Internet”. This is problematic because we want to provide solutions that will prove to be profitable for our clients as well as for us.
If you often run into this scenario then fear not, we have put together a small list of ways that you can advise your client on how to generate revenue with their sites.
There are five high level ways for a site to generate revenue: sell a product, sell a service, advertise, charge your users, or through donations. Each method has its benefits and drawbacks and we will outline the details and options available with each.
Sell A Product: This one is pretty obvious. If your client desires to sell a product then their method for generating revenue is pretty obvious and this is less of a concern. This is not to say that your clients who sell a product on their site cannot benefit from some of the other revenue streams indicated in this posting such as advertising so read on.
Sell A Service: Similarly like Selling A Product this is a pretty obvious solution, businesses such as Web Design, Web Development, Consulting etc fall into this category but can benefit from other revenue streams as well.
OK, now onto the real stuff…..
Advertise: OK this is a big one. When you look at the business model employed by some of the larger sites on the Internet that do not “sell” products such as MySpace and Facebook their revenue is generated through advertising. Now there are all types of advertising from per click to per purchase and so on. Sites such as these that collect personal information for use in your profile are able to deliver “Targeted Advertising” which delivers a much higher rate of pay (CPM) or Cost Per Thousand Impressions. The reason it delivers this level of revenue is because this method delivers advertisements which are relevent to the user. So a 25 year old guy who is interested in Computers will not receive an advertisement for Vogue Magazine thus the return for the client is much higher. This is something that we are delivering more and more and is truly the way to go for this stream of revenue.
Charge Your Users: While this is a legitiment way to generate revenue it is a way that we generally shy away from. There are so many sites out there that are GIVING away their service for free that you really must have something that people cannot do any other way in order to charge your users and still keep your users. Even the ideas of charging for advanced features do not generally work. There is always an exception to the rule but what you have to ask yourself is, “Is there someone else out there that would be my competitor who is doing this for free?” If the answer is yes, then rethink charging for your service and allow us to help you come up with another revenue stream. Particularly in the fields of Social Networking, charging for service is a bad idea.
Donations: This revenue stream works well with not for profit businesses that want to get on the Internet and there are a lot of people that are willing to donate. We have seen this work with businesses like The Humane Society who need an advanced web application in order to facilitate missing pets, etc, and had people provide donations to make that happen. Mind you that Venture Capitalists do not fall in this category, VC are going to still want to see that they are going to get their money back and then some. Regardless, donations generally work in a not for profit scenario.
We hope that this has provided you a high level look of how you can advise your clients on how to generate revenue on the Internet.
The Web Business : Personal Thoughts
January 10th, 2008
JUST8660So there are a ton of technical blogs and forums out there that will help you with everything from Simple Problems to Architecting Enterprise Solutions. But what there seems to be a lacking of is help on how to run a Web Business or Software Business in general. Through the years here at Override we have become very efficient at everything from Making a Pitch to assisting our larger clients in obtaining Venture Capital.We thought that dedicating a section to assisting you folks out there who are great designers and developers with the necessary part of running your business that may not always be the most fun. We think that you will find as you get into it that you can enjoy the business aspect just as much as you enjoy doing what you originally got into the business to do, design or develop! Some general thoughts that will lead you to success are: be positive, value what you do, and never give up!What do we mean by this? Maintaining a positive attitude is key. You are not going to get all of the jobs that you bid on and that is something that you should know upfront but going into a bid you have to know that you have the best proposal on the table and that a bid that is as comprehensive as yours should be valued. Where we are going with that is, you don’t always have to be the lowest bidder in order to win. Value what you do! Please learn from our pitfalls, when you get caught in a lowballing war, just go ahead and concede. If the client does not value what you do then they will not value the product when it is finished. Trust us, there are plenty of contracts out there but don’t take a loss on a project just to get it.Finally, NEVER GIVE UP! Just when you think that things are going poorly it is just a chance for God to step in and send some massive business your way. We can testify to time after time where it didn’t look promising and just in time the Lord sent a MAJOR contract our way. Something that we truly wanted to do and paid GREAT!Bottom line, if you love it you will do it, stay positive, value yourself, and NEVER GIVE UP, give Him the praise and God will prosper you!God Bless,Justin Tabb
Simple Filereader / Filewriter
January 7th, 2008
JUST8660Have you ever needed to search through a large recordset in a FLAT file and write out only records that match a certain criteria to another file. We had that instance where we needed to search through a 750 MEG Text file (yeah, too big to open in Notepad) and find only transactions that match a certain account number for one of our clients being audited. The answer was a simple VB.NET Console Application. You simply loop through each line and using a Substring Command you evaluate whether the account number is present, if it is you write the entire line to another file that was created by the program during the process. VB.NET Code is pasted below…——————————————————————————————-Imports System.IO
Module Module1
Sub Main()
‘ The File you are needing to evaluate
Dim filename As String = “C:\PTTR0203.TXT”
‘The text you are evaluating against Dim searchkey As String = “20572733″
‘Just to count for curiosity sake Dim i As Integer = 0
‘Create the StreamReader Dim sr As StreamReader = File.OpenText(filename)
‘ Let yourself know the process began Console.WriteLine(”File Scanning Begun”)
Dim input As String
‘ Make INPUT equal to each line in a loop of the file input = sr.ReadLine()
‘ Find the account number space in the string Dim myaccount As String
‘ Create the file you are going to write to, ‘ in this case it will create the file with whatever the SearchKey (Account number) is plus.txt Dim fs As New FileStream(”C:\” & searchkey & “.TXT”, FileMode.Create, FileAccess.Write)
‘ Create the Streamwriter Dim sw As New StreamWriter(fs)
‘ Begin your loop While Not input Is Nothing myaccount = input.Substring(4,
‘ Evaluate whether it matches your search string If myaccount = searchkey Then Console.WriteLine(input)
‘ Write it to a file sw.WriteLine(input) i = i + 1 End If End While
‘ Close the reader sr.Close()
‘ Dispose of the writer sw.Dispose()
‘ Tell yourself you are done and how many records you scanned Console.WriteLine(”Process Complete ” & i & ” files processed”)
End Sub
End Module
Simple PHP Mail Form
December 28th, 2007
JUST8660Sometimes the most simple problems are the ones that developers have the hardest time with and it seems like those are the most frustrating. So in an effort to save developers hard times with some of the most simple things we are posting solutions to seemingly simple problems here.
This is a script that will generate an e-mail in PHP, and unlike other sites we are going to post the WHOLE solution here.
So here goes the code and the complete PHP file is attached….
Place this at the very top of your PHP file (and make sure it has a .php extension)
<?php
if(array_key_exists(’btnSubmit’, $_POST)) {
$to = “you@yourdomain.com“;
$from = $_POST[’txtemail’];
$subject = “A Message From Your Contact Page”;
$phone = $_POST[’txtphone’];
$fromname = $_POST[’txtname’];
$comments = $_POST[’txtcomments’];
$message = “$fromname\n”;
$message .= “$phone\n”;
$message .= “$from\n\n”;
$message .= “$comments”;
$additionalHeaders = “From: $fromname<$from>”;
$mailSent = mail($to, $subject, $message, $additionalHeaders);
}
?>
That is all there is to the PHP part, now for the form…
Inside your body tags of course place the following code….
<form name=”contact” action=”#” method=”post” class=”con”>
<label>Name</label>
<input type=”text” name=”txtname” class=”txtbox” />
<label>Email</label>
<input type=”text” name=”txtemail” class=”txtbox” />
<label>Phone Number</label>
<input type=”text” name=”txtphone” class=”txtbox” />
<label>Comments</label>
<textarea name=”txtcomments” cols=”" rows=”"></textarea>
<input type=”submit” name=”btnSubmit” value=”" class=”submit” />
<a href=”javascript:document.contact.reset();”><img src=”images/btn_reset.gif” alt=”reset” class=”reset”/></a>
</form>
Welcome to the Override Web Productions Blog!
December 28th, 2007
adminWelcome to the Override Web Productions Blog. We here at Override Web Productions are always trying to come up with ways to further the development community so we figured what better way than to start our own blog. Basically what we are going to use this blog for is, as we overcome problematic situations in the course of our projects and as time and confidentiality allows we are going to post articles about them here.
We here at Override have many subject matter experts in all aspects of software development so we hope that this becomes a useful tool. Feel free to contact us with any questions or if we can assist you with any projects that you currently have.
Kind regards,
Justin Tabb
Lead Solutions Architect
Override Web Productions
Categories
- ASP.NET (1)
- eCommerce (1)
- General Posts (2)
- PHP (1)
- The Web Business (3)
- VB.NET (2)