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

Some tidbits of VS2008 goodness.

8. April 2009

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 , , , , ,

New BlogEngine.Net Theme and site

17. February 2009

I wanted to share with everyone that I created a new online magazine using BlogEngine.Net. I made use of all the existing features of of Blogengine along with a few new widgets and extensions.  I even created a new theme to go along with it.  I don’t know if I will share it at this time because it is specific to my site.  But the odds are it will show you some new ways to use the software.

Take a look at it and let me know what you think.

I will get into the specifics of the site in a later post.  

 

Just an update for everyone.  You can now visit the site at http://www.ichoosetofeel.net.  Please take a look and review it.  It's ad free and we don’t ask for money.

.Net, BlogEngine.Net, Book, Essays, General, Looking Back, Music, Peace, Religious Science, Reviews , , , , ,

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

Cookies, what I forgot and how I fixed it.

10. October 2008

I don't do much with cookies and kept making a goof.  YOU MUST ALWAYS SET THE EXPIRY AFTER YOU SET THE VALUE.

I found this article which led me to the answer here.

.Net