jQuery and Asp.Net Gridview

26. May 2009

So you have a fancy jQuery table sorter that you want to use but just realized, or thought you knew, that the Gridview control does not render the thead tags.  Guess what ,it does!  You just have to add this tidbit of code in your codebehind before the prerender event and viola!

 

GridView1.HeaderRow.TableSection = TableRowSection.TableHeader

 

This will render the thead and you are all ready to go with that new little jQuery toy you just downloaded.

.Net, Visual Studio, Tips and Tricks, jQuery

BlogEngine.Net and Facebook

17. April 2009

I just wanted to let everyone know that I just finished some work on BlogEngine to run as a Facebook application.  I have a couple of polishes to put on it and I will post it. 

Let me know if you are interested in the source code.

Thanks,

Roman

BlogEngine.Net, .Net, Visual Studio, Tips and Tricks

XmlDatasource caches automattically.

9. April 2009

If you run into the issue of using a data control such as a gridview with an xmldatasource….

 

Make sure that you set the EnableCaching property equal to false.

http://forums.asp.net/t/1262408.aspx

Microsoft, Visual Studio, Tips and Tricks

I got a funny feeling I am going to need this again.

30. March 2009

I am working on a field in a SQL2005 database that stores custom attributes in an xml data type column.  I am pretty sure that I am going to  need this link in the near future.

http://msdn.microsoft.com/en-us/library/ms345117.aspx

.Net, Tips and Tricks, Visual Studio

HttpHandler and Session State

6. March 2009

Its funny when you use a specific solution to solve many problems over and over and then you find out the limitation of your “genius” solution.  Kind of a let down huh?  What if you soon discover that your solution still is “genius” and solves the problem you thought you had.  that is a good feeling if I say so myself. 

I just started to "heavily using HttpHandlers that are dependant on the session state.  The site that I have been working on requires Session so there was no way around it.  The issue that kept coming up is that the context.Session that was getting passed to the ProcessRequest method was always null.  I needed the Session and the link I am including gave me the answer. 

To save you the read, you can use to Interface markers to tell IIS that you need the Session passed to your handler, IRequiresSessionState or IReadOnlySessionState.  Guess what, you know have the current Session being passed to your handler.   Hope it helps.

 

http://bytes.com/groups/net-asp/341797-session-object-null-http-handler

.Net, Visual Studio, Tips and Tricks, Microsoft , , , , ,

Here is a little pesky #$%^ that is a real time waster.

12. January 2009

The message below is from a someone who is constantly sending me comments.  I finally found a way to block him.  If you search on my site you will find a way to block other IP addresses automatically.  If you know this guy send him up the river.  With peace, love and a smile of course. Search "block ip address reverse dns".<-- I am using this as code so any webot will not figure out what I am doing.  Thos pesky things.

Weblog comment on Thought Paper: On what “create”, “creative”, and “creativity” mean to me.

Busby SEO Test to inspirit
yeah you also a creative, thanks for the nice thought

Post: Thought Paper: On what “create”, “creative”, and “creativity” mean to me.

_______________________________________________________________________________

Author information
Name: Busby SEO Test
E-mail: buds.lite@gmail.com
Website: pinayspeak.com/pinaytest/
Country code: US
IP address: 120.28.142.194
Referrer: http://www.romanclarkson.us/post/Thought-Paper-On-what-e2809ccreatee2809d-e2809ccreativee2809d-and-e2809ccreativitye2809d-mean-to-me.aspx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

General, Tips and Tricks

Securing http cookies without changing your base code

6. January 2009

I came across a situation where a ASP.Net 1.1 application had a security scan done and one of the issues that came back was the fact that the cookies were not marked secure.  Not a major issue.  However, if you have a product base that is customized many times over, how do you change everything in production without wasting a lot of time and resources.  The goal is to not modify the existing code for any of the product bases, create complete http cookie coverage, and simplify the testing and redeployment of a single assembly.

Interested in the fix?

Here is what I came up with....

An HttpModule.  My HttpModule reads every cookie coming in and out, marks them as secure, sets and expiration time and forces it to http only.  Basically, everything that needed to be done and more to the cookies in order to satisfy the security scans.  Below is all the code we needed to create the http module.

 
using System;
using System.Web;

namespace Jaws.Core.Web
{
    public class SecureCookies : IHttpModule
    {
        #region Implementation of IHttpModule

        /// <summary>
        /// Initializes a module and prepares it to handle requests.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpApplication" /> that provides access to the methods, properties, and events common to all application objects within an ASP.NET application </param>
        public void Init(HttpApplication context)
        {
            context.PreRequestHandlerExecute += SecureAllCookies;
            context.PreSendRequestContent += SecureAllCookies;
        }

        /// <summary>
        /// Disposes of the resources (other than memory) used by the module that implements <see cref="T:System.Web.IHttpModule" />.
        /// </summary>
        public void Dispose()
        {
            //Nothing to Dispose of at this point.
        }

        private static void SecureAllCookies(object sender, EventArgs e)
        {
            var context = (sender as HttpApplication);

            if (context != null)
            {
                foreach (string cookie in context.Request.Cookies)
                {
                    context.Request.Cookies[cookie].Secure = true;
                    context.Request.Cookies[cookie].Expires = DateTime.Now.AddMinutes(10);
                    context.Request.Cookies[cookie].HttpOnly = true;
                }
            }
        }

        #endregion
    }
}

.Net, Tips and Tricks

Get the Request.Forms value of a control

26. November 2008

Just a little FYI.  I have a dropdown control in a data grid on a web page.  I was trying to get the updated value but it was not being returned properly.  So, I found the Request.From[“control name”] by using the server control property called UniqueId.  UniqueId maps to the posted name of the server control Id.

system.web.ui.control.uniqueid

.Net, Visual Studio, Tips and Tricks

MS Web Application Stress Tool – Localhost not working

30. October 2008

I looked every where for this on Google and could not come up with the answer.  You have to add a “.” at the end of localhost for the script to record.  I just happen to try it because I installed fiddler and it said to do it.  Insane!!

 

Here was my last Google search  when I came up with the idea to try it:  web application stress tool configure for logins post

.Net, Microsoft, Tips and Tricks

Install WLW when you are not allowed to use Windows Update

30. June 2008

I discovered this work around when I could not install Windows Live Writer.  The company I did work for does not allow the use of Windows Update.  This article allows you to do the work around.  Something about this does not make much sense in terms of security.

http://msdn.microsoft.com/en-us/library/aa387285.aspx

Tips and Tricks