So you want to be a .net developer? Web, Backend, Middle Tier? You’re asking yourself where do I start?

So occasionally I get asked from friends and friends of friends and friends of friends of friends, I want to be a <insert, programmer, web developer, build websites, etc>.  How do I get started?

This is a loaded question. There so many directions to go and languages to choose from and then there is the college route, certification route or both. Then you have the Unix side of the house, the Microsoft side, now the all popular apple and android sides. Web platform, OS platform or mobile platform. Then you have to figure out where you like to work the most; on the front-end UI, back-end logic or maybe the database layer.

So for this article I’m going to with a bunch of assumptions.

  • You want to build web applications (You can apply this to OS applications, website and mobile later)
  • I’m assuming college doesn’t matter and is not needed (though a Computer Science degree would be awesome)
  • You aren’t doing it for the money (more on this later)
  • You’re following the Microsoft track using .NET (though the same techniques can be applied to other languages and application types, got to start somewhere)

 

You are not in it for the money:

This is my biggest pet peeve. If you are trying to be a programmer because you think they get paid a lot. Stop right now and go find something else to do.  Do what you like not because it pays a lot. Those type of programmers are the worst I ever meet. You go to work and do your job and try to get all your learning from on the job training. You go home and don’t give a crap about your job or try and don’t try to learn and enhance your skill sets at home.  You drain the life out of all the other programmers at work. I’ve seen this time and time again.

If you want to be a good programmer, or awesome, programming needs to be your hobby. You need to go home after work and continue learning.  You have to have a desire to be on the computer; programming your own projects for fun to learn new techniques after work. At home at night on the weekends. In life you should do what makes you happy and what you enjoy. Not because you think you can make a lot of money. If you don’t enjoy programming, don’t do it. I can go on about this so I’ll stop here.

 

What to Learn:

  • The Presentation Layer (or what we can the “Front-End” work): This is the visual aspects of your application and interactions. What it looks like how it functions.
    • HTML – Must Learn
    • CSS – You can get away with it if you don’t like front-end work but you should learn the basics
    • Javascript – You can get away with it if you don’t like front-end but you should learn the basics
    • jQuery – This heavenly needed for good interactions on your web application but you could get away with this if you don’t like the front-end. However, you should have a basic understanding.

Training Suggestions: On the web. Start with W3Schools. Great site, simple and straight forward. Soak in all the information you need. Always a good resource.

  1. W3Schools – For each section complete the “Basic” section. HTML, HTML5, CSS, CSS3, HTML DOM, JavasScript, jQuery,
  • The Business or Middle Tier Layer (or what we call the “Back-End”): This is the logic and heart of your application. Taking the information provided in the Presentation Layer and doing something with it. Calculations, data manipulation, saving it to the database etc..
    • .NET C# (or VB.NET but C# is more popular now a days and usually pays more (being that you are doing this even as a hobby, then yes pay is important and a side-benefit.))
    • ASP.NET MVC3 (this is newer then ASP.NET WebForms which is just as popular, but MVC is the future)

Training Suggestions: On the web and study books for certifications. Some people knock certifications, usually the ones that don’t have one. Certifications won’t make you great, only experience will do that. However, Certifications will teach you everything you should know and aspects that others don’t know because they don’t study for the certs. Small things here and there that add up. As well as showing to an employer that you might not have experience but you definitely can program and know the basics if you have your certs. More about certs in an updated post. Old post here.

  1. ASP.NET is a great place to get started. Specifically ASP.NET / MV3 site. Go through Chapters 1 through 12.
  2. C# Station – I’d stay maybe go to chapter 8 or 10.
  • The Database Tier (Also, part of the “Back-End”): This is storing data. Manipulating data. How to retrieve the data and run reports or searches.
    • First learn some SQL basics from W3Schools. Go through all the SQL Basic chapters.
    • Optional: Then you can learn say T-SQL which is Microsoft language of SQL built off of basic SQL. However, you don’t need this yet and learn as you go after W3Schools.

This is enough to get you started. Learn all the basics then figure out where you like to play the most.

  • Advanced Items: Other things you should know.

Getting Out of Memory Exception when you have plenty of Memory/RAM available

 

This is a great article on why having or adding more memory won’t fix your Out of Memory Exception.   Bottom line.. on a 32bit server you’re site will crash when it hits between 600MB and 800MB.  The amount varies based on what else is going on with the machine.   The solution? Basically, you have to upgrade to a 64bit OS or re-write your application.

 

Why adding more memory won’t fix your Out of Memory error by Edge

Copied from the article directly, in case it ever goes down.

-------------------------------------------

Here an interesting case. Consider there 2 scenarios:

Both are running the same website, both have the same amount of users connected.

Now imagine this website has a page to upload pictures, just like any regular photo-album website.

For some reason, at some point the users complain that they see an error page indicating out of memory error.

So, you wonder: How come? they are just uploading a photo to my website, and I still have plenty of memory in my server anyway.

Anyhow, you stop thinking about this and go for the easiest, quick and dirty solution: If the system tells me that my computer does not have enough memory then I just need to add more memory. Right?

And guess what? you still will get the error message.

That's a very common mistake. Having a machine with 10GB of memory does not mean you will have 10GB of memory available. I explain.

It does not matter if your computer or server has 512 MB, 1 GB, 2 GB, 4 GB or 8 GB of RAM. If your machine is a 32-bit machine it will only be able to see/manage 4 GB. That's mathematics, that's life, that's the way things are and you can't do nothing about it. A 32-bit machine can not do more than that.

Additional memory may increase your system performance, but it won't increase the memory availability. Sure your computer will use less the hard disk for swapping operations and will be able put more stuff in memory and start some programs faster, but 4GB is the limit; after this point the memory management module will start doing disk swap and to use the famous page file.

And here comes more bad news: Your Windows system on a 32-bit machine requires 2 GB allocated only for it.

So, if you have 4 GB installed, effectively you will have 2 GB only for applications; your windows will be using alone 2 GB.

So, what does out of memory means?

Well, according to some people at Microsoft, this limit for an average configuration is reached between 600 MB and 800 MB of utilization. That 800 number is NOT A RULE, is a baseline. Generally speaking the largest majority of configurations with website, .NET and SQL Server database might have a problem around this point. Of course, this can vary from system to system...as a matter of fact a system can be out of memory at just 600 MB.

Yes, it does sounds crazy. You look so happy now that you just bought a 4GB RAM notebook and your computer is breaking with just 800MB, hun?

Here is another point for you. Have you ever seen someone bragging that he/she bought a 10-megapixel camera and now he/she believes their pictures are going to be better because of this?

Well, guess what? Just like the number of megapixels in a camera box does not have much to do with picture quality, RAM memory does not have much to do with hard disk space.

That's a common mistake: People buy RAM as if they were buying a hard disk.

RAM usage needs to me continuous, unlike hard disk. A simple 5MB Microsoft Word document when saved in a hard disk can be split up in hundreds of pieces; When you open this file in memory, the RAM requires those 5MB to be allocated continuously.

Can you see now the reason for the 'out of memory' message?

Yes, it really means 'there is not enough continuous memory to place that file in memory'. Your system might have 2GB of RAM but unfortunately it might be too busy with stuff running and there is no enough continuous memory to put the picture you are uploading.

Yeah, you can not do much but you can buy a 64-bit machine then when you add more memory you can really use it more efficiently. And yes, we have Microsoft Windows systems for 64-bit machines.

If you do not want to buy a new system of upgrade you current server to a better version then you should think other solutions in the business process, such as to avoid users upload pictures with more than 1 MB in size to be uploaded.

Response.Redirect Thread Was Being Aborted. Properly Handle this Exception and not with a Try/Catch.

 

Due to Response.End calls Thread.Abort.

To avoid this error you can catch for it like most people do it.

Or do it the “right” way.

Don’t call Response.End by using the overload.  Use HttpApplication.CompleteRequest() instead.

Response.Redirect(stringURL, False)
HttpContext.Current.ApplicationInstance.CompleteRequest()

Unfortunately, since you’re not aborting the thread the postback finishes and the html gets sent to the client.

Found a great post on the topic here by John S. Reid, where he goes into details on the solution.  For now, here’s the final solution. I would suggest a base page. But this is what you would have on your actual page.

 

Private blnPageIsTerminating As Boolean = False

Protected Sub SomePageEventOrOtherMethodThatYouAreRedirectingFrom()
    Response.Redirect(UrlDocumentLink(oCurrDocument.DocumentMasterID), False)
    HttpContext.Current.ApplicationInstance.CompleteRequest()
    blnPageIsTerminating = True
End Sub

Protected Overrides Sub RaisePostBackEvent(ByVal sourceControl _
           As IPostBackEventHandler, ByVal eventArgument As String)
    If blnPageIsTerminating = False Then
        MyBase.RaisePostBackEvent(sourceControl, eventArgument)
    End If
End Sub

Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
    If blnPageIsTerminating = False Then
        MyBase.Render(writer)
    End If
End Sub

Disabling ASP.NET Validators via Client Side Javascript

I had the need to disable my asp.net expression validator when some other client side events fired a post back.

 

Here’s the snippet if you need it.

function specialClientSideToDo()
{
  var reValidator= document.getElementById('<%=reValidator.ClientID%>');
  ValidatorEnablereValidator, false); 
}

 

Later I re-enable after I’m done doing whatever I had to do.

Control Your Windows Service from a Asp.NET Web App, Start, Stop, Run A Method

 

Maybe you find the need to; or you think of the possibilities of controlling a Windows Service from a Web App might be useful.  For me I like the idea of writing a Windows Service that does some server function but can be controlled or called by a user. This is a more detailed post on code examples from the previous post with some other considerations.

Examples Reasons?:

  1. Maybe a Administrator needs to start and stop services but doesn’t have access to the server by normal methods.
  2. A user that calls a Windows Service that performs some type of Emailing functionality such as a notifying users when they have a new Task.  Maybe this table is populated by many means. Win service would check the database every 30min and send off emails.  In your web app, your users are special, so every time they assign a task, you fire off the windows service right there and then. Or maybe sometimes you have the need to fire off a manual send and have written redundant code to do it.
  3. Windows service control center for developers? Or Support users?

 

Anyway, the process is quite easy.

 

Windows Service code, somewhere have a method like this…

Code Snippet
  1. Protected Overrides Sub OnCustomCommand(ByVal command As Integer)
  2.     MyBase.OnCustomCommand(command)
  3.     Select Case command
  4.         Case 130
  5.             'Call one of your other methods from here
  6.         Case 150
  7.             'Call some other method or command
  8.         Case Else
  9.             'Do Nothing
  10.     End Select
  11. End Sub

You can only call one CustomCommand, so you send in Command Integers and from there decided what you want to do.

 

In your ASP.Net app on a button click event..

Code Snippet
  1. Using sc As System.ServiceProcess.ServiceController = New System.ServiceProcess.ServiceController()
  2.     sc.MachineName = "Mastro-PC"
  3.     sc.ServiceName = "ComplyTrackMainTimer"
  4.     sc.ExecuteCommand(130)
  5.     'sc.Stop()
  6.     'sc.Start()
  7. End Using

This will work on a web.app on a button click event. You have to set the MachineName and the ServiceName. You can also Stop() and Start() the Service or look up the Status.

You can get the MachineName of the server by opening a command prompt from the server and typing in “HostName”

image

You can get the ServiceName by opening up the server and looking at the name in Services. Don’t use the Display Name use the Service Name.

image

I have a previous post on this with more detailed information on valid Command Integers and Security.

Silverlight Timeout Issues from WCF… exceeded the allotted timeout.

 

So you’re getting error message…

The HTTP request to <URL To WCF Service> has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout.

 

Three places to set time values to fix this issue…

 

1) Web.Config

<httpRuntime executionTimeout="600" />

(this is seconds, so here it’s 10min).   More info on httpRuntime here.

2) On your Web.Config Binding Elements

<binding name="customBinding123" 
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00" />

3) On your ServerReferences.ClientConfig binding elements within the system.serviceModel

<binding name="CustomBinding" 
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00" />

On Authentication Timeout - Save Web Form Contents

I was working on a project recently where I had to figure out how to persist user data in a web form after their Forms Authentication session as expired.

So I was thinking of ways to do this as I searched the know all Google. Walla!  Someone's already had to do this, why invent the wheel.  Found a post by Peter Ravnholt, on the MSDN site. http://code.msdn.microsoft.com/formsaver 

He Implements the HttpModule and handles saving the form state on FormAuthentication events. Really neat idea.  I tried is code, now keep in mind I'm doing this for Visual Basic, so I manually converted it all, but I couldn't get it work. Maybe I was converting something wrong.  I was getting "The state information is invalid for this page and might be corrupted."

Well RichardDeeming in the discussions for this post had an updated version that worked a little better then the original. http://code.msdn.microsoft.com/formsaver/Thread/View.aspx?ThreadId=88  Thanks to his code, I converted it to VB.Net and walla!  My pages now handle web content.

I'll post the converted VB version below. 

Thanks Richard and Peter if you ever find your names on here via Google :p

This is my VB version o the FormSaverHttpModule with Richard's changes.  I've modified it a bit since but this works.

Imports Microsoft.VisualBasic
Imports System.Security.Principal
Imports System.IO
Imports System.Web.Configuration
Imports System.Security.Permissions
 
''' <summary>
''' FormSaverModule Version 1.0
''' -Mastro:  Not my orignal idea, found this in use out on MSDN site. I manually converted it to VB
''' as the orignaly is in C#. No comments, so I'll add my own.
''' 
''' This class will handle every new request coming in and PostMapRequest. 
''' If user has Forms Authentication has timed out, class will save the state of the form into cache
''' with a Unique ID of that state to the user's cookie. 
''' 
''' When user logs back in, this class will check if they have the cookie set, if so it will then 
''' load that state back to their page and load the webcontent by generating a runtime transit page that
''' post submits the data back to the destination page and pre-fills in the values.
''' </summary>
''' <remarks></remarks>
<AspNetHostingPermission(SecurityAction.LinkDemand, Level:=System.Web.AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class FormSaverHTTPModule
    Implements IHttpModule
 
#Region "Private Variables"
 
    Private Const CookieName As String = "#FormStateSaverModule/FormRestoreId"
    Private Shared ReadOnly StateCacheDuration As TimeSpan = TimeSpan.FromMinutes(40)
    Private Shared ReadOnly _AnonymousUser As IPrincipal = New GenericPrincipal(New GenericIdentity(String.Empty), Nothing)
    Private _FormsCookieName As String
    Private _LoginUrl As String
 
#End Region
 
    ''' <summary>
    ''' This class is required from the IHttpModule contract
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
 
    End Sub
 
    ''' <summary>
    ''' This is the first method to run on application start
    ''' </summary>
    ''' <param name="Context"></param>
    ''' <remarks></remarks>
    Public Sub IHttpModuleInit(ByVal Context As HttpApplication) Implements System.Web.IHttpModule.Init
        Me.Init(Context) 'Lets call our Init and send the Application state along with it
    End Sub
 
    ''' <summary>
    ''' We call this Init Method from the IHttpModuleInit and send it the Application State
    ''' and then turn on Events to capture
    ''' </summary>
    ''' <param name="Context">Hold's the Application State</param>
    ''' <remarks></remarks>
    Protected Overridable Sub Init(ByVal Context As HttpApplication)
        If Context Is Nothing Then
            Throw New ArgumentNullException("context")
        End If
 
        _LoginUrl = FormsAuthentication.LoginUrl 'Store the Login page name
        _FormsCookieName = FormsAuthentication.FormsCookieName 'Store the Forms Authentication Cookie Name
 
        If Not String.IsNullOrEmpty(_LoginUrl) Then 'If LoginUrl Exists....
            Dim index As Integer = _LoginUrl.IndexOf("?"c) 'Search for a ? for query string
            If -1 <> index Then 'If ? was found....
                _LoginUrl = _LoginUrl.Substring(0, index) 'Grab the first part of the URL before the ? and set LoginUrl
            End If
        End If
 
        'Add Handlers that now raise events on every Application BeginRequest... and Application PostMapRequest
        AddHandler Context.BeginRequest, New EventHandler(AddressOf Application_BeginRequest)
        AddHandler Context.PostMapRequestHandler, New EventHandler(AddressOf Application_PostMapRequestHandler)
 
    End Sub
 
    ''' <summary>
    ''' A Delegate receiver method for the Application.BeginRequest Event
    ''' </summary>
    ''' <param name="sender">Object</param>
    ''' <param name="e">EventArgs</param>
    ''' <remarks></remarks>
    Protected Overridable Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        Dim application As HttpApplication = DirectCast(sender, HttpApplication)
        Dim context As HttpContext = application.Context
 
        Dim cookie As HttpCookie = context.Request.Cookies(CookieName)
        If cookie IsNot Nothing AndAlso Not String.IsNullOrEmpty(cookie.Value) Then 'If Cookie exist and has value....
            Dim state As FormState = FormState.Load(cookie.Value) 'Lets try and load the state via the CookieID
 
            'Lets see if the State is valid now that it's loaded and it's originaly location matches where the user is trying to go
            If state IsNot Nothing AndAlso String.Equals(state.Path, context.Request.Path, StringComparison.OrdinalIgnoreCase) Then
                FormState.SetCurrent(context, state) 'State is valid and it's for this request so lets create the object of the state to be used later by Application_PostMapRequestHandler
                Return
            End If
        End If
 
        If IsPost(context) AndAlso Not IsAccessingLoginPage(context, _LoginUrl) Then 'If user is doing a Post back and it's not to the login page...
            cookie = context.Request.Cookies(_FormsCookieName) 'Load Authenication cookie
            If cookie IsNot Nothing Then
                Try
                    Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(cookie.Value)
                    If ticket IsNot Nothing AndAlso ticket.Expired AndAlso Not HasAnonymousAccess(context) Then 'If the user has expired.....
                        Dim state As FormState = FormState.Create(context) 'Store current state into cache
                        If state IsNot Nothing Then
                            cookie = New HttpCookie(CookieName, state.StateId) 'save cache ID into user's cookie
 
                            cookie.HttpOnly = True
                            context.Response.Cookies.Add(cookie)
                        End If
                    End If
                Catch generatedExceptionName As ArgumentException
                End Try
            End If
        End If
    End Sub
 
    Protected Overridable Sub Application_PostMapRequestHandler(ByVal sender As Object, ByVal e As EventArgs)
        Dim application As HttpApplication = DirectCast(sender, HttpApplication)
        Dim context As HttpContext = application.Context
 
        Dim state As FormState = FormState.GetCurrent(context) 'Get the context from the cache if it's there
        If state IsNot Nothing AndAlso state.Form IsNot Nothing AndAlso 0 <> state.Form.Count Then 'if the context was there....
            context.Handler = New FormStateSaverHandler(state) 'Then load the runtime transit page and post it back to destination page
        End If
    End Sub
 
    ''' <summary>
    ''' Returns Boolean if request is a Post request to page.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Shared Function IsPost(ByVal context As HttpContext) As Boolean
        Return String.Equals("POST", context.Request.HttpMethod, StringComparison.OrdinalIgnoreCase)
    End Function
 
    ''' <summary>
    ''' Return Boolean after it checks to see if content matches the LoginURL. Basically is the user 
    ''' going to the login page.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Shared Function IsAccessingLoginPage(ByVal context As HttpContext, ByVal loginUrl As String) As Boolean
        Dim result As Boolean = False
        If Not String.IsNullOrEmpty(loginUrl) Then
            If String.Equals(context.Request.Path, loginUrl, StringComparison.OrdinalIgnoreCase) Then
                result = True
            ElseIf -1 <> loginUrl.IndexOf("%"c) Then
                Dim temp As String = HttpUtility.UrlDecode(loginUrl)
                If String.Equals(context.Request.Path, temp, StringComparison.OrdinalIgnoreCase) Then
                    result = True
                Else
                    temp = HttpUtility.UrlDecode(loginUrl, context.Request.ContentEncoding)
                    If String.Equals(context.Request.Path, temp, StringComparison.OrdinalIgnoreCase) Then
                        result = True
                    End If
                End If
            End If
        End If
 
        Return result
    End Function
 
    ''' <summary>
    ''' Returns Boolean if the destination URL in question has anonymouse access.
    ''' </summary>
    ''' <param name="context"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Shared Function HasAnonymousAccess(ByVal context As HttpContext) As Boolean
        Return UrlAuthorizationModule.CheckUrlAccessForPrincipal(context.Request.Path, _AnonymousUser, context.Request.HttpMethod)
    End Function
 
    ''' <summary>
    ''' This class becomes the actual FormState the user was on and is Serialzied and then saved 
    ''' </summary>
    ''' <remarks></remarks>
    <Serializable()> _
    Protected NotInheritable Class FormState
        Private Shared ReadOnly FormRestoreKey As New Object()
 
        Private ReadOnly _id As String
        Private ReadOnly _path As String
        Private ReadOnly _form As NameValueCollection
 
        Private Sub New(ByVal id As String, ByVal path As String, ByVal form As NameValueCollection)
            _id = id
            _path = path
            _form = form
        End Sub
 
        Public ReadOnly Property StateId() As String
            Get
                Return _id
            End Get
        End Property
 
        Public ReadOnly Property Path() As String
            Get
                Return _path
            End Get
        End Property
 
        Public ReadOnly Property Form() As NameValueCollection
            Get
                Return _form
            End Get
        End Property
 
        ''' <summary>
        ''' Loads the state that was set by Setcurrent and tries to return it as a FormState object.
        ''' Returns nothing if it's invalid.
        ''' </summary>
        ''' <param name="context"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Shared Function GetCurrent(ByVal context As HttpContext) As FormState
            If context Is Nothing Then
                Return Nothing
            End If
            Return TryCast(context.Items(FormRestoreKey), FormState)
        End Function
 
        ''' <summary>
        ''' Takes the state sent and creates a valid formstate object
        ''' </summary>
        ''' <param name="context"></param>
        ''' <param name="state"></param>
        ''' <remarks></remarks>
        Public Shared Sub SetCurrent(ByVal context As HttpContext, ByVal state As FormState)
            If context IsNot Nothing Then
                context.Items(FormRestoreKey) = state
            End If
        End Sub
 
        ''' <summary>
        ''' Takes the Context of the current Request Form and stores it into Cache with a Unique ID
        ''' </summary>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Shared Function Create(ByVal context As HttpContext) As FormState
            Dim result As FormState = Nothing
            If context IsNot Nothing AndAlso context.Request.Form IsNot Nothing AndAlso 0 <> context.Request.Form.Count Then
                Dim id As String = Guid.NewGuid().ToString()
                result = New FormState(id, context.Request.Path, context.Request.Form)
                HttpRuntime.Cache.Add("FormStateSaver_" + id, result, Nothing, Cache.NoAbsoluteExpiration, StateCacheDuration, CacheItemPriority.Normal, _
                Nothing)
            End If
            Return result
        End Function
 
        ''' <summary>
        ''' Loads the Context stored in Cache using the Unique ID
        ''' </summary>
        ''' <param name="id">Unique GUID</param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Shared Function Load(ByVal id As String) As FormState
            Dim result As FormState = Nothing
            If Not String.IsNullOrEmpty(id) Then
                result = TryCast(HttpRuntime.Cache("FormStateSaver_" + id), FormState)
            End If
 
            Return result
        End Function
 
        ''' <summary>
        ''' Deletes the stored Context from Cache
        ''' </summary>
        ''' <remarks></remarks>
        Public Sub Delete()
            HttpRuntime.Cache.Remove("FormStateSaver_" + _id)
        End Sub
    End Class
 
    ''' <summary>
    ''' This class is responsible for generating the Transit page on the fly. 
    ''' Basically a page that loads all the values then submits them back to the destination
    ''' page with the previous viewstate settings so that the form reloads the controls to where
    ''' they were prior.
    ''' 
    ''' This page quickly shows when the user is logging back in and loading a previous web form.
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Protected Class FormStateSaverHandler
        Implements IHttpHandler
 
        Private ReadOnly _state As FormState
 
        Public Sub New(ByVal state As FormState)
            _state = state
        End Sub
 
        Protected ReadOnly Property FormState() As FormState
            Get
                Return _state
            End Get
        End Property
 
        Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Get
                Return False
            End Get
        End Property
 
        Public Overridable Sub ProcessRequest(ByVal context As HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
            Try
                Using writer As HtmlTextWriter = CreateHtmlTextWriter(context.Response.Output, context.Request.Browser)
                    Me.Render(writer)
                End Using
            Finally
                _state.Delete()
            End Try
        End Sub
 
        Protected Overridable Sub Render(ByVal writer As HtmlTextWriter)
            writer.RenderBeginTag(HtmlTextWriterTag.Html)
            writer.RenderBeginTag(HtmlTextWriterTag.Head)
            writer.RenderBeginTag(HtmlTextWriterTag.Title)
            writer.Write("Restoring form")
            writer.RenderEndTag()
            ' TITLE 
            writer.RenderEndTag()
            ' HEAD 
            writer.AddAttribute("onload", "document.forms[0].submit();")
            writer.RenderBeginTag(HtmlTextWriterTag.Body)
 
            writer.AddAttribute("method", "post")
            writer.RenderBeginTag(HtmlTextWriterTag.Form)
 
            Dim form As NameValueCollection = Me.FormState.Form
            For Each name As String In form.Keys
                RenderHiddenField(writer, name, form(name))
            Next
 
            'writer.AddAttribute(HtmlTextWriterAttribute.Align, "center")
            'writer.RenderBeginTag(HtmlTextWriterTag.P)
            'writer.Write("You should be redirected in a moment.")
            'writer.WriteFullBeginTag("br")
            'writer.Write("If nothing happens, please click ")
            'RenderSubmitButton(writer, "Submit")
            'writer.RenderEndTag()
            ' P 
            writer.RenderEndTag()
            ' FORM 
            writer.RenderEndTag()
            ' BODY 
            writer.RenderEndTag()
            ' HTML 
        End Sub
 
        Protected Shared Sub RenderHiddenField(ByVal writer As HtmlTextWriter, ByVal name As String, ByVal value As String)
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "hidden")
            writer.AddAttribute(HtmlTextWriterAttribute.Name, name)
            writer.AddAttribute(HtmlTextWriterAttribute.Value, value)
            writer.RenderBeginTag(HtmlTextWriterTag.Input)
            writer.RenderEndTag()
            ' INPUT 
        End Sub
 
        Protected Shared Sub RenderSubmitButton(ByVal writer As HtmlTextWriter, ByVal text As String)
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "submit")
            writer.AddAttribute(HtmlTextWriterAttribute.Value, text)
            writer.RenderBeginTag(HtmlTextWriterTag.Input)
            writer.RenderEndTag()
            ' INPUT 
        End Sub
 
        Protected Shared Function CreateHtmlTextWriter(ByVal writer As TextWriter, ByVal browser As HttpCapabilitiesBase) As HtmlTextWriter
            If browser Is Nothing Then
                Return New HtmlTextWriter(writer)
            End If
            Return browser.CreateHtmlTextWriter(writer)
        End Function
 
 
    End Class
 
 
End Class
 
 
 
 
 

 

Update: 6/10/10

Here is the original post, and it was moved to codeplex here.  Thanks Peter Revnholt!

IIS7 Windows7/Server2008 ApplicationPoolIdentity Security Change from Network Service

 

Yeah this one got me.. http://learn.iis.net/page.aspx/624/application-pool-identities/

The change microsoft made to have AppPool now run as “ApplicationPoolIdentity” instead of Network service.

So if you normally give Network Service rights needed to your webapp, you now have to stop doing that and change it to

IIS AppPool\DefaultAppPool

Or

IIS AppPool\<NAME OF YOUR APPPOOL>

End of that.

 

 

 

 

  1. Open Windows Explorer
  2. Select a file or directory.
  3. Right click the file and select "Properties"
  4. Select the "Security" tab
  5. Click the "Edit" and then "Add" button
  6. Click the "Locations" button and make sure you select your machine.
  7. Enter "IIS AppPool\DefaultAppPool" in the "Enter the object names to select:" text box.
  8. Click the "Check Names" button and click "OK".

By doing this the file or directory you selected will now also allow the "DefaultAppPool" identity access.

Optimizing Pages that use Telerik Controls. Mainly RadGrid

 

I was watching a webcast on Telerik TV, it’s called Optimizing RadGrid for ASP.NET Ajax.  There is a lot of useful information there. I summarized a bunch of it.

On my test page I…

  • Added Browserfile...
    • Compressing ViewState for RadTelerik controls  (Dropped viewstate considerably from sample page, 50,776 bytes to 5,428 bytes)
  • Added RadCompression for AJAX Calls to drop traffic size on ajax post-backs (Not handled by IIS compression)
  • Reduce Request using StyleManager and RadScriptManager
    • Added RadStyleSheetManager to MasterPage (Combines all CSS sheets into one download to limit requests)
    • Switched to RadScriptManager on Masterpage instead of ScriptManage
      • Request dropped from 71 to 47

 

Summarized Tips

  • Bind Grid Data on PreInit event, this will keep data from going to the ViewState and cut down on page size
  • If the Grid is ReadOnly and no editing takes place, then turn off viewstate for the Grid. EnableViewState="False"
    • Features that will NOT work when viewstate is off
      • Custom Edit Forms (User Control or Form Template)
      • Filtering
      • Grouping
      • Using Cached Data and Paging Together
    • Features that WILL work when view state is off
      • Indexes of Selected Items
      • Indexes of Edited Items
      • Group-by Expressions and Settings (but not the expanded state of grouped items)
      • Sort Expressions
      • Style Properties (But not if applied to a single cell or row in ItemDataBound event)
      • Column Order and other column properties
      • All settings concerning hierarchy structure (but not the expanded state of the items)
  • Optimized Column Editors on Grid
    • Used Shared Data Picker for Date columns in your grid
      • This requires a hidden data picker on page, and template column with textbox that uses js to talk to the datepicker with client-api (See Example Here)
    • Use Template column for comboxes and use Load-On-Demand
  • Ajaxify the Grid
    • Compresses Ajax calls which IIS misses, use RadCompression to drop traffic size
    • Use StyleManager and ScriptManager to bundle all css and scripts into one call each to server
  • More Tips Here
  • Other Ways to Optimize
    • Client-side Binding
    • Custom Paging
    • Virtual Scrolling
    • Caching Data server-side
    • Hierarchy Load modes
    • Group load modes
    • Filtering
    • .NET 3.5 + Linq
    • Upgrade from IE6

 

Other Controls

  • Other Controls
    • Use Shared Data Picker
    • Use RadInputManager if you want Validated or Stylized instead of using the the RadNumeric or RadTextbox controls
    • Use Load-On-Demand RadComboboxes
    • On RadMultiPage set RenderSelectedPageOnly = True
    • Hide Grid's with Visible="False" not with surrounding Div's set to display none.
      • Hiding the Grid itself, it doesn't render or get bound, grid will get data when visible is set to true again.
  • Add App_Browsers folder with a file that has.. (This one is HUGE, dropped my page significantly)
    • Create a file and add
    • <browsers>
          <browser refID="Default">
              <controlAdapters>
                  <!--<adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadHiddenFieldPageStateCompression" />-->
                  <adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadSessionPageStateCompression" />
              </controlAdapters>
          </browser>
      </browsers>

Microsoft Certification Step-By-Step Road Map for .NET Development, SQL 2008 Server, Team Foundation and Sharepoint

I’ve put together, from the Microsoft Site a Step-By-Step plan for getting certifications by Microsoft in the areas of .Net 3.5 Development, Team Foundation Server, Sharepoint and SQL 2008.

I’ve listed in order that you need to study and take exams that makes the most sense. The links go back to the Microsoft site Training/Certification pages.  This list is to make it easy.  Just follow it down and you study the book or e-learning class, then you take the listed exam and you get the listed certification.

Step Order

Study Press Book or E-Learning

Take This Exam

Get This Certification

 

.NET 3.5 Development Track (See Notes for 2.0 Track)

   

1

Microsoft Press Book

· MCTS Self-Paced Training Kit (Exam 70-536):
Microsoft .NET Framework--Application Development Foundation,
Second Edition

Microsoft E-Learning

· 5161AE: Advanced development with the Microsoft .NET
Framework 2.0 Foundation (16 Hours)

· 5160AE: Core development with the Microsoft .NET
Framework 2.0 Foundation (14 Hours)

Exam 70-536

 

2

Microsoft Press Book

· MCTS Self-Paced Training Kit (Exam 70-562):
Microsoft .NET Framework 3.5 - ASP.NET

Microsoft E-Learning

· 6463AE: Visual Studio 2008: ASP.NET 3.5 (20 Hours)

Exam 70-562

MCTS: .NET Framework 3.5, ASP.NET Applications

3

Classroom Training

· 01: Learning Plan for Designing and Developing ASP.NET Applications
Using the Microsoft .NET Framework 3.5 (Exam 70-564) (1 Forms)

Exam 70-564

MCPD: ASP.NET Developer 3.5 on Visual Studio 2008

Note: 2.0 Track

Since the previous exam has no book at this time, you can also take the .NET 2.0 Track Instead take Exam, Exam 70-528 and Exam 70-547 instead for 2.0 Certification.

 

MCTS: .NET Framework 2.0, ASP.NET Applications
AND
MCPD: Web Developer on Visual Studio 2005

4

Microsoft Press Book

· MCTS Self-Paced Training Kit (Exam 70-505):
Microsoft .NET Framework 3.5 -- Windows Forms Application Development

· MCTS Self-Paced Training Kit (Exam 70-526):
Microsoft .NET Framework 2.0 Windows-Based Client Development

Microsoft E-Learning

· 2546AE: Core Windows Client Development with
Microsoft Visual Studio 2005 (18 Hours)

· 2542AE: Advanced Data Access with
Microsoft Visual Studio 2005 (12 Hours)

· 2547AE: Advanced Windows Client Programming with
Microsoft Visual Studio 2005 (12 Hours)

· 2541AE: Core Data Access with
Microsoft Visual Studio 2005 (16 Hours)

Exam 70-505

 

5

Classroom Training

· 001: Learning Plan for Designing and Developing Windows
Applications Using the Microsoft .NET Framework 3.5 (Exam 70-563) (1 Forms)

Exam 70-563

MCPD: Windows Developer 3.5 on Visual Studio 2008

Note: 2.0 Track

Since the previous exam has no book at this time, you can also take the .NET 2.0 Track Instead take Exam, Exam 70-526 and Exam 70-548 instead for 2.0 Certification.

 

MCPD: Windows Developer on Visual Studio 2005

6

Microsoft Press Book

· MCTS Self-Paced Training Kit (Exam 70-561):
Microsoft .NET Framework 3.5 - ADO.NET

Microsoft E-Learning

· 6464AE: Visual Studio 2008: ADO.NET 3.5 (20 Hours)

Exam 70-561

 

7

Microsoft Press Book

· MCTS Self-Paced Training Kit (Exam 70-503):
Microsoft .NET Framework 3.0—Windows Communication Foundation

Microsoft E-Learning

· 6461AE: Visual Studio 2008:
Windows Communication Foundation (20 Hours)

Exam 70-503

 

8

Classroom Training

· 01: Learning Plan for Designing and Developing Enterprise Applications
Using the Microsoft .NET Framework 3.5 (Exam 70-565) (1 Forms)

Exam 70-565

MCPD: Enterprise Application Developer 3.5 on Visual Studio 2008

Note: 2.0 Track

Since the previous exam has no book at this time, you can also take the .NET 2.0 Track Instead take Exam ,Exam 70-529 and Exam 70-549 instead for 2.0 Certification.

 

MCPD: Enterprise Application Developer on Visual Studio 2005

 

SharePoint Certifications

   

9

Microsoft Press Books

· The Microsoft SharePoint Step by Step Kit:
Microsoft Windows SharePoint Services 3.0 Step by Step
and Microsoft Office SharePoint Designer 2007

Microsoft E-Learning

· 5403AE: MCTS (Exam 70-631):
Microsoft Windows SharePoint Services 3.0, Configuring (12 Hours)

Exam 70-631

MCTS: Microsoft Windows SharePoint Services 3.0 – Configuration

10

Microsoft Press Books

Inside Microsoft Office SharePoint Server 2007

Microsoft E-Learning

· 5404AE: MCTS (Exam 70-630):
Microsoft Office SharePoint Server 2007, Configuring (12 Hours)

· 3376AE: Implementing Enterprise Search Using
Sharepoint Technologies (8 Hours)

Exam 70-630

MCTS: Microsoft Office SharePoint Server 2007 – Configuration

11

Microsoft E-Learning

· 5392AE: Developing and Extending Microsoft Windows SharePoint
Services 3.0 with Visual Studio 2005 (12 Hours)

· 5385AE: Developing Solutions with Microsoft Windows SharePoint
Services 3.0 and Visual Studio 2005 (12 Hours)

Exam 70-541

MCTS: Microsoft Windows SharePoint Services 3.0 – Application Development

12

Microsoft E-Learning

· 6071AE: Developing Solutions with Microsoft Office SharePoint
Server 2007 and Visual Studio 2005 (12 Hours)

Exam 70-542

MCTS: Microsoft Office SharePoint Server 2007 – Application Development

 

Team Foundation Server Certification

   

13

Classroom Training

· 6215A: Implementing and Administering
Microsoft Visual Studio 2008 Team Foundation Server (2 Days)

Exam 70-510

MCTS: Microsoft Team Foundation Server: Configuration and Development

 

SQL 2008 Certifications

   

14

Microsoft E-Learning

· 6369AE: Implementing and Maintaining Microsoft SQL Server 2008 (16 Hours)

· 2778CE: MCTS (Exam 70-433): TS: Microsoft SQL Server 2008, Database Development (18 Hours)

Microsoft Press Books

· MCTS Self-Paced Training Kit (Exam 70-432):
Microsoft SQL Server 2008 - Implementation and Maintenance

Exam 70-432

MCTS: SQL Server 2008, Implementation and Maintenance

15

Classroom Training

· 01: Learning Plan for Designing, Optimizing and Maintaining a
Database Server Infrastructure
using SQL Server 2008 (Exam 70-450) (1 Forms)

Exam 70-450

MCITP: Database Administrator 2008

16

Microsoft E-Learning

· 2778CE: MCTS (Exam 70-433): TS: Microsoft SQL
Server 2008, Database Development (18 Hours)

Microsoft Press Books

· MCTS Self-Paced Training Kit (Exam 70-433):
Microsoft SQL Server 2008 - Database Development

Exam 70-433

MCTS: SQL Server 2008, Database Development

17

Classroom Training

· 01: Learning Plan for Designing Database Solutions and Data
Access using SQL Server 2008 (Exam 70-451) (1 Forms)

Exam 70-451

MCITP: Database Developer 2008

18

Microsoft Press Books

· MCTS Self-Paced Training Kit (Exam 70-448):
Microsoft SQL Server 2008 -
Business Intelligence Development and Maintenance

Exam 70-448

MCTS: SQL Server 2008, Business Intelligence Development and Maintenance

19

Microsoft Press Books

· Microsoft SQL Server 2008 Reporting Services Step by Step

· Microsoft SQL Server 2008 MDX Step by Step

Exam 70-452

MCITP: Business Intelligence Developer 2008