in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, Office 365 / SharePoint Online and Visual Studio 2013.

April 2005 - Posts

  • Web Service References in Visual Studio 2005

    I have to say there are a lot of things about ASP.NET projects that I really just don't like any more in 2.0.  First, expect that the conversion process from 1.1 to not move your web references to the correct folder, so you will have to readd them all.  Web references are now in the folder App_WebReferences.  What is different is that when you add a web reference, it just creates a new folder with the name of the web reference (it also did this behind the scenes in 1.1).  There are no properties that you can configure like in the past.  To make it even more wierd there is no reference.cs file so somehow it just magically works.  It adds a line to your web.config but since asp.net web projects don't use namespaces any more, be aware that they keys will be different.
  • Visual Studio 2005 Beta 2 Expiration Date

    In case you are wondering, Visual Studio 2005 Beta 2 can be used until May 1, 2006.  After that, it will cease to function.
  • More on Page LifeCycle

    I talked about the Page LifeCycle earlier.  Here is the complete Page LifeCycle.  Unfortunately, this lame sharepoint control doesn't support tables so the list doesn't look very pretty.  I've hilighted some but not necessarily all of the new events.  Remember where this list is, because you will probably want to refer back to it at some point.
     
    Constructor Always
    Construct Always
    TestDeviceFilter Always
    AddParsedSubObject Always
    DeterminePostBackMode Always
    OnPreInit Always
    LoadPersonalizationData Always
    InitializeThemes Always
    OnInit Always
    ApplyControlSkin Always
    ApplyPersonalization Always
    OnInitComplete Always
    LoadPageStateFromPersistenceMedium PostBack
    LoadControlState PostBack
    LoadViewState PostBack
    ProcessPostData1 PostBack
    OnPreLoad Always
    OnLoad Always
    ProcessPostData2 PostBack
    RaiseChangedEvents PostBack
    RaisePostBackEvent PostBack
    OnLoadComplete Always
    OnPreRender Always
    OnPreRenderComplete Always
    SavePersonalizationData Always
    SaveControlState Always
    SaveViewState Always
    SavePageStateToPersistenceMedium Always
    Render Always
    OnUnload Always
    This article has more information about some of the changes in ASP.NET 2.0 and has been updated to reflect the changes in Beta 2.
     
     
  • BONUS TIP! More on Obsolte APIs

    I was converting some ASP.NET code from 1.1 to 2.0 last night and I ran into some of the items that are now considered obsolete.  Since none of you I am sure have bothered to read that document, I'll point out what I found.
     
    The ConfigurationSettings class has been marked as obsolete.  You most likely have used this for it's AppSettings collection.  It has been replaced with the ConfigurationManager class.  You can use the AppSettings collection just like you had before.  One thing to note is that it also provided a ConnectionStrings collection for use with the new ConnectionStrings section of the web.config.  It also provided the GetSection which allow you to get an entire configuration section (if you create your own for example).
     
    The System.Web.Mail.SmtpMail class has also been marked obsolete.  This has been replaced with the System.Net.Mail.SmtpClient class.  The syntax appears to be the same as the old mail object.   However this new object also supports a SendAsync method which will let you send the message without blocking the thread.  It also supports a bunch of new properties such as credentials, ports, ssl support, and timeouts.
     
    Note, that you can still use the Obsolete API calls and your application will still work.  However, the compiler will display a warning every time you compile letting you know things are obsolete.
  • ASP.NET Site Management Tools

    Some of you already know about the new tools for managing ASP.NET applications, but I wanted to cover them a little more today.  In IIS, a new ASP.NET tab is available when you look at the properties of a particular web site.  This tab lets you specify which version of the framework the site will use.  The Edit Configuration Button will allow you to change anything that goes in the web.config from an easy to use form.  You can change things like Connection Strings, Application Settings, Session State providers and more.
     
    Another tool that was added was the ASP.NET Web Site Administration tools.  This tool can be accessed via the browser and allows you to configure some of the same settings as above.  The easiest way to get to this page is to click Web Site Administration in the Web Site menu of Visual Studio 2005.  It can also be accessed by going to the asp.netwebadminfiles virtual directory of your web site.
  • No-Compilation Pages

    There is a new compiler directive in ASP.NET 2.0 that allows you to tell the compiler not to compile a specific page.  This is useful on pages that are completely static that do not have any code on them.  To set this, simply add CompilationMode="Static"  to the pages compiler directive.  Youc an also set this to Auto to have the page compile as needed.
  • BONUS TIP! Exception Handling in the Debugger

    After using VS2005 Beta 2 for a while yesterday, I have to say one of the cooler new features is when stepping through an exception.  When your code causes an exception, a balloon pops up on the exception and you can click on it to get more detail and even some possible reasons why the exception was caused.  It's definitely a nice new feature.
  • Page Framework Lifecycle

    As if the Page Framework Lifecycle in ASP.NET wasn't complicated enough, a few new events can now be overridden to do new things.
     
    InitializeCulture is used for ASP.NET 2.0's new multilingual support.  I'll talk more about this in the future.
     
    OnPreInit can be used to set a theme or a master page file at runtime.  I'll also talk more about themes in the future.
     
    Controls also have two new events LoadControlState and SaveControlState.  ControlState is a new feature for controls that allows controls to save and load values even when viewstate has been disabled on a page.  Unfortunately, it is not as convenient to use as ViewState is.  Again, I'll also talk more about this in the future as well.
     
    There are also some other new events OnInitComplete, OnPreLoad, OnLoadComplete, OnPreRenderComplete, and OnSaveStateComplete.  I don't know exactly what all these are intended for yet, but if you are interested in any of them I'll try and find out.
  • VS2005 Previous Beta Removal Tool

    If you have a previous version installed and want to automate getting rid of all the old system components, this tool should be able to help you get things removed.
     
  • Beta 2 Initial Reactions

    I've been playing with Beta 2 for a little bit and here is what I have noticed so far.  It seems to be pretty slow (although this may be because I have Nero burning stuff right now).  I tried to get the Alert system to work on it and typed datasets from 1.1 don't seem to get converted right (I noticed that in Beta 1 as well).  You keep getting an error about the namespace not being recognized when you try to compile.  So I then just made a reference to my 1.1 assembly and it was actually able to send a message but there was a problem with one of the callbacks being null (no idea why on that one) which caused the application to crash.  So far, it's been a bad time, but I'll continue to work with it.
  • ANOTHER BONUS TIP! Form Fields and Events in ASP.NET 2.0

    In the past when you created a new textbox, label, dropdownlist, or whatever in an ASP.NET page or control, you had to go into design view to make the variable declaration show up in the code behind.  Then sometimes your form would be hosed and Visual Studio wouldn't bother to create the variable declaration.  The same thing was true with events.  The easiest way to create an event was to double click on a button, etc to get the event created.
     
    .NET 2.0 introduces the concept of a partial class.  The code behind page has the new partial modifier on the class declaration.  What this means is anything declared in the markup (form fields, etc.) does not have to have a matching reference in the code behind.  Simply adding the form field to the markup (design view not necessary) is enough to make Intellisense find the object and allow you to access it in the code behind.
     
    Events work the same way.  I am sure you have seen lines like this in your InitialzeComponent method.
     
    this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
     
    Now whenever you want to bind a click event to a button, you can simply add OnClick as one of the attributes to the form field, such as.
     
    <asp:button id="MyButton" OnClick="MyButton_Click" runat="server" Text="Blah" />
  • BONUS TIP!!! Better Web Projects in ASP.NET

    I am going to start going over some of the more basic features of Visual Studio 2005 that are significant that you may or may not know about yet.
     
    The first thing they did with ASP.NET Web Projects was to get rid of the project file (no more .csproj).  This is both good and bad.  It is good because, you no longer have to Rochambeau somebody when they left it checked out when you need to add a new file.  It is bad because there is no way to exclude a file from compilation other than to physically delete it from the file structure.  This can make things terrible when you do a get latest from source control.  All in all, it is probably better but it will take some getting used to.
     
    One of the biggest new features is that IIS is no longer required to be installed on your local machine unless you are writing applications that deal with NTLM authentication, etc.  Visual Studio 2005 will spawn a Personal Web Server for a ASP.NET project located anywhere on your file system.  If you do have IIS installed, Front Page Server Extensions are no longer required for Visual Studio to access that project.  Do you have a side project somewhere on some joebob hoster that only allows FTP support?  Visual Studio 2005 can now open projects via FTP.
     
    Web Publishing support has also been improved quite a bit.  People might actually use it now.  It can be used to keep files synchronized between servers and will tell you which files are not synchronized.  It even logs which files it changes, etc.  This could be really useful for deploying to tweb41.
     
    With Beta 2's release, I will continue to post more and more so that all of you have the best information for this new product.
  • Obsolete APIs in .NET Framework 2.0

    As with every new release, some methods have been rendered obsolete.  I haven't seen anything to note yet, but it might be worth taking a look at some time.
     
  • Beta 2 has been released

    We have been waiting a long time for this.  Beta 2 has been released.  Here is information about removing the previous version on your machine. 
     
     
    I am currently downloading it now and will start providing more information as it comes available.  More information can be found at the link below.   Of the versions posted, there is Standard Edition as well as Team Suite.   The Team Foundation Server is also available in a seperate install.
     
  • ValidateEmptyText with CustomValidator

    One of the bad times with CustomValidators in ASP.NET 1.1 was that the validation event will not fire when the ValidationText property was empty (i.e.: a textbox was empty).  This was a bad time, because it required you to add a RequiredFieldValidator to ensure that the field was completed.  The CustomValidator now has a ValidateEmptyText property.  Setting this property to true will force the validation event to fire even when the control that is getting validated is empty.
More Posts Next page »
2015 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems