If you have a child app configured in IIS, and you don’t want the web.config of the parent application to affect your child app, here is how you tell the parent app’s config file to go chill down by the river alone. Example: blah.com/web.config
If you’ve ever seen this error, you probably pulled your hair out (if you still have some) and can’t figure out why IIS won’t just serve up your page. What is this madness about “There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined” nonsense? Well, this is one of those things that is super simple to fix [...]
Internet Explorer is nearly always half-baked, never having decent support for the latest language syntax and causes more problems than it solves. IE8 is no exception, really causing ridiculous problems that it shouldn’t. Developers spend days on things that should normally take minutes, because Microsoft teams make a habit out of ignoring best practices and [...]
So I am really dumb sometimes. Other times it is my obliviation to the obvious, otherwise known as true ignorance and unexplored knowledge, but certain things CAN be done in code that are allowed but should not be done. For example, there should only be one public partial class per page (as far as I [...]
When the images won’t appear on your reports and you can’t get them back, try this code. It worked for me. Basically, this tells dotnet to use the Crystal Reports image viewer to get the image and use it on the report. You’ll need to put this is the section of your web.config file. You [...]
November 3 2010 by
Ryan Carter in
ASP.NET,
C# |
For some reason I am coding away and inexplicably, usually when trying to update my Subversion repository, the aspx.designer.cs file that is attached to my page simply decides to ignore all my controls. Perhaps a guru who knows why could explain in the comments, and I am just ignorant. I wouldn’t argue that with you. [...]
October 29 2010 by
Ryan Carter in
ASP.NET,
C# |
Test to see if it DOES exist if(Session["Name"]!=null){ // It does exist, so do stuff! } OR test if it DOESN’T exist if(Session["Name"]==null){ // It doesn’t exist! }
If you want to perform a sum or count on the records in a DataTable, you can, very simply. You’ll have to have a DataTable with something in it, like results from a database, then you do this: // my DataTable is full of customer data and is named "dt" object newCustomerCount = dt.Compute("count(id)","CustomerID > [...]
To set the text, or displayed value of a Label Control in ASP.NET, do this: lblName.Text = "Ryan"; One thing to note is how to name label controls, with a prefix of “lbl” which helps you identify the type of control anywhere in the code. Also, if you are going to be using a variable [...]
This accepts a GUIDW length parameter and will return the random GUID, sans hyphens, ready for appendage to your filename, string, or other random use. Enjoy! Courtesy of 4guysfromrolla.com public string GetRandomPasswordUsingGUID(int length) { // Get the GUID string guidResult = System.Guid.NewGuid().ToString(); // Remove the hyphens guidResult = guidResult.Replace("-", string.Empty); // Make sure [...]