Tuesday, July 22, 2008

Recently I had to make an .mdb file accessible for download after authentication and couldn't allow a direct link to the file. We had written a similar handler for .xls and others (.csv, etc...) - we sent back a few headers to set the file name and the mime type and then server.transfer'd to stream out the binary file.

Turns out that IIS maps .mdb files to the aspnet_isapi.dll executable by default (in fact on the server we were testing it was also mapped to a perl interpreter... go figure) , making server.transfer cough. We were receiving the following error when trying to do the transfer:

System.Web.HttpException: Error executing child request for /{ourdirectory}/{ourfilename}.mdb

[HttpException (0x80004005): Error executing child request for /{ourdirectory}/{ourfilename}.]
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2672379
   System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +819
   System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +57
   System.Web.HttpServerUtility.Transfer(String path) +35
   {mycontrol}.Page_Load(Object sender, EventArgs e) in {path to my control file}.cs:33
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

One of the options that we found was to simply remove the mapping in IIS, but then I ran into the problem of not being able to remove the mapping from the ASP.NET Development Server (at least in a way I could figure out easily). So, option 2 presented itself and we found it to be the best solution for both situations. Simply add the following in the <httpHandlers> section of your web.config:

<remove verb="*" path="*.mdb" />

If you don't have an httpHandlers section of your web.config, it goes in as a subsection of <system.web>

<system.web>
<!-- ... other stuff .. -->
<httpHandlers>
<remove verb="*" path="*.mdb" />
</httpHandlers>
<!-- ... other stuff ... -->
</system.web>

No more problems with code like the following:

Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + myFileName);
Response.Flush();
Server.Transfer(baseVirtualPath + myFileName);

No my dev environment using Asp.Net Development Server had the same settings that the IIS 6 app had, so I could test and debug properly.

Some helpful links that helped me solve the problem:

http://www.eggheadcafe.com/software/aspnet/29460604/iis-6-wont-serve-mdb-fil.aspx
http://forums.asp.net/p/1022569/1393806.aspx

posted on 7/22/2008 4:38:33 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
  • Blog reactions
  •  Monday, July 14, 2008

    I recently developed an application using Linq to Sql against SQL Express for my development environment. Initially, I was under the impression that it would be running in a SQL 2K5 production environment, but at my first deliverable discovered that I was going to have to port back to SQL 2000 prior to delivery.

    I thought at first that the only real changes I would have to make is reducing my varchar(max) types to the 2K5 upper limit and continue on, but discovered some pretty severe limitations to using Linq To SQL against SQL 2000.

    To access my LTS objects and methods, I wrapped everything up into a data layer that returned either single enties or IQueryable for multiple result sets, this in turn was consumed by my business layer which generally converted to lists or something that made a little more since to the presentation. On my port back, IQueryable seems to be where I ran into the problems. I was running into errors like the following:

    Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator.

    Cannot translate expression to SQL for this server version.Translation would contain an expression of type Text, NText or Image in a SELECT DISTINCT clause

    Cannot translate expression to SQL for this server version

    Using SQL 2000 as the back-end doesn't allow me to do complex queries when the results contain nText or binary data as the derived sql makes extensive use of DISTINCT. Against SQL Express I had become accustomed to chaining together multiple IQueryable methods and then calling my datacontext to execute a single method. Now, I found myself having to make use of .ToList in virtually every complex query that involved a table at any join level that contained a BLOB. Lots and lots of junk across the wire...

    I still don't have a workable solution to allowing IQueryable to be replacement for collections and am in the process of combining methods anywhere that IQueryable no longer makes sense which is tedious and hopefully will be rendered unnecessary.

    That was a lot of lead up to what I really wanted to post - The limitations of SQL Server Express...

    For ages (at least several months), I have been developing against SQL Express and find it easy to use, light weight and very capable. However, I had never before considered the possibility that SQL Express could be a viable dbms, especially in a production environment. My application is complex, but not huge.

    The limitations of SQL Express are simply resource limits and not functional limits. As long as my db is smaller than 4GB in size (if I manage my log files well, there is no reason it shouldn't be) and doesn't require more than 1 CPU and 1 GB of RAM, SQL Express should be a fully capable and possibly even desirable alternative to the enterprise editions of even SQL 2005. These are not hardware limits, but resource limits constrained by the application itself. This means that SQL Express could probably live nicely on a web server and that the db service, out of the box, wouldn't grab an excessive share of resources.

    Using SQL Express would help me to avoid extensive re-writes and would allow the client to install without any additional software purchases. I covet any feedback on your experiences using SQL Express in a production environment and any feedback in general about this post.

    In addition, here are some links I found useful to finding the source of my problem in the first place:

    H

    posted on 7/14/2008 1:53:44 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
  • Blog reactions
  •  Friday, May 30, 2008

    I needed a quick and dirty way to get my LinqToSQL results into a datatable due to a constraint by a component we were using. I couldn't find a decent mechanism for doing so within IQueryable, so I extended the following ToDataTable method. Any comments would be greatly appreciated.

    <Extension()> _
    Public Function ToDataTable(ByVal o As IQueryable) As DataTable

        Dim dt As New DataTable
        Dim props = o.ElementType.GetProperties
        For Each prop In props
            'Datatable doesn't like System.Nullable as a type, so I accounted for the two nullable fields I was using...
            If prop.PropertyType Is GetType(System.Nullable(Of DateTime)) Then
                dt.Columns.Add(New DataColumn(prop.Name, GetType(DateTime)))
            ElseIf prop.PropertyType Is GetType(System.Nullable(Of Integer)) Then
                dt.Columns.Add(New DataColumn(prop.Name, GetType(Integer)))
            Else
                dt.Columns.Add(New DataColumn(prop.Name, prop.PropertyType))
            End If
        Next
        For Each obj In (From x In o Select x)
            Dim oRow = dt.NewRow
            For Each prop In props
                If prop.GetValue(obj, Nothing) Is Nothing Then
                    ' Don't set it to anything!!!
                Else
                    oRow(prop.Name) = prop.GetValue(obj, Nothing)
                End If
            Next
            dt.Rows.Add(oRow)
        Next
        Return dt
    End Function

    kick it on DotNetKicks.com

    posted on 5/30/2008 10:35:55 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
  • Blog reactions
  •  Friday, April 25, 2008

    Recently, I started developing new applications around the Umbraco Content Management System. I use the term around very lightly, because Umbraco really doesn't require any constraints on your code (like DNN, Rainbow and virtually every other .Net based CMS that I have used), other than the need to develop in user controls instead of aspx pages - which makes perfect sense given the idea of a CMS. It has worked flawlessly and is easily the best .net based CMS system around from a developer AND designer perspective.

    I ran into my first hiccup yesterday when trying to develop using AJAX in Umbraco. My design project had been setup to target the 3.5 extensions, while Umbraco is generally configured to use the 2.0 version with the AJAX extensions. All is well with controls, until trying to use AJAX - apparently enough changed under the hood to require a dependency for the version of the ScriptManager and UpdatePanel being used.

    The Umbraco community came to the rescue before the ink was dry on my forum post. The initial reply to my issue came within a few minutes on the public Umbraco forums [My Post] and while their first suggestions didn't fix the problem, it certainly led me in the right direction and on to the final solution: http://forum.umbraco.org/yaf_postst1245_A-version-compatible-with-Windows-Server-2008--ASPNET-35.aspx

    BTW - all it takes to get Umbraco to start using the 3.5 extensions is the following addition to your web.config:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>

    Just before your closing <\configuration> tag.

    Thanks to Doug Robar, Sjors Pals, Tim Geyssens, Casey Neehouse and Petr Snobelt and the rest of the Umbraco world for such an awesome application and community. For all of the grief that Umbraco is given about documentation being sparse and decentralized - after you spend a couple of weeks in the forums, setting up your Umbraco tag at del.icio.us and technorati, and learning XSLT, those concerns evaporate and you begin to see an unrivaled depth of support, content and community.

     

    Technorati Tags: , ,

    del.icio.us Tags: , ,

    kick it on DotNetKicks.com

    posted on 4/25/2008 10:24:39 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
  • Blog reactions
  •  Wednesday, April 09, 2008

    This makes absolutely no sense whatsoever... I am trying to get my head around how the NRLC considers a voting record that is consistent to be a voting record that is truly pro-life. IMHO - A stance on embryonic stem cell research similar to McCain, reveals the heart of his true stance on the sanctity of life. Spineless sellouts - this has nothing to do with sanctity of life and everything to do with politics.

    The National Right to Life Committee (NRLC), the nation’s largest and most influential pro-life organization, has announced the “unanimous” decision by its board of directors to back Republican presidential hopeful John McCain.

    Prominent Pro-Life Group Backs McCain | Christianpost.com

    posted on 4/9/2008 11:40:29 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
  • Blog reactions
  •  Friday, April 04, 2008

     Are you serious?

    We are going to nationalize the cement industry,” Chavez said in a cabinet meeting late Thursday broadcast on radio and television, adding that effected companies would be compensated.

    “Starting now, take all the legal and economic steps to nationalize in the short term the national cement industry, everything that was privatized,” Chavez told his ministers.

    France’s Lafarge and Mexico’s Cemex are the two major cement companies in Venezuela.

    And from Bloomberg:

    The Venezuelan leader said he would ban asphalt exports and is restricting shipments of food abroad, all part of his effort to overcome shortages amid the fastest economic growth in the Americas. Chavez has accused building-material suppliers of running a monopoly and slowing the construction of homes and roads.

    From: Chavez to nationalize cement industry in Venezuela
    and: Chavez Plans to Nationalize Venezuela Cement Industry

    posted on 4/4/2008 8:22:45 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [3]
  • Blog reactions
  •  Wednesday, March 12, 2008

    This list is from here: 101 Useful Resources for Online Entrepreneurs, but I have removed all the links that aren't free and republished. I will also add more as I find them. It is a terrific list of resources for the those starting or operating business. As I read through the list, it was difficult to figure out from the descriptions which ones were free, so I edited the list and crossed out the ones that aren't. Enjoy. Please visit the original link above as well, as I would hate to be accused of link jacking... just wanted to make the list more usable and it was a real pain to sort through them all - trying to save you the trouble.

    Communications/VOIP

    1. Skype - Free calls over the internet to other people on Skype for as long as you like.
    2. Vonage - Leading provider of VoIP internet broadband telephone services.
    3. Gizmo - Low cost international calling and free calls to users on Yahoo Messenger, Google Talk, Windows Live users and SIP networks.
    4. Vonics Digital - Plans start at $12.99 per month lowest price available in the market.
    5. VoipBuster - Free program that uses the latest technology to bring free and high-quality voice communications to people all over the world.

    Data Backup

    1. Mozy - Industry-leading solution for online backup.
    2.
    Intronis - Online backup solution with remote computer data backup software.
    3.
    Carbonite - Unlimited online backup for one flat fee.
    4.
    Data Deposit Box - Your source for online backup, and secure online data backup.
    5.
    Athena Backup - Automatically backup your home computer files with Athena Backup.
    6.
    Data Protection Services - Secure online backup services, free trial!

    1. I couldn't find any of these for free... But GDrive works pretty well and also - which is not to be confused with the GDrive project from Google, which will blow most of these out of the water.
    2. Micro$oft SkyDrive looks promising too.

    Invoicing

    1. Bamboo Invoice - Simple, Open Source, Online Invoicing.
    2. FreshBooks - Online invoicing and time tracking service. - Limited number for free
    3. Transcepta - Electronic invoicing solution.
    4. Blinksale - The easiest way to send invoices online. - Free, but you only get three invoices per month in that version
    5. InterlinQ Solutions - Providing a daily job report, time sheets, job tracking, construction reports and mobile billing.
    6. Bill My Clients - Easy way to create and send invoices and bills to your clients. - Not free, but reasonable considering they actually send by postal mail.
    7. Billing Orchard - Online electronic billing software application.
    8. 2nd Site - Secure invoicing service w/ online invoice payment & online employee timesheets. - 3 Invoices per month for free

    Financial Management and Accounting

    1. Intacct - Delivers ERP software as a service to small and midsize companies.
    2.
    QuickBooks Online - Accounting Solutions for professionals and businesses.
    3. Xero - Slash the hours you spend every week on accounting administration. - Can try for free, but have to pay to setup a live company

    Time Management and Project Management

    1. Google Calendar - Free online shareable calendar service.
    2. Vitalist - Web based task manager designed to work with Getting Things Done (GTD). - Free to 10 projects
    3. Backpack - Personal and small business information management, intranet, and to do list organizer. - Free for 2 users
    4. Basecamp - Web-based tool that lets you manage and track projects. - Free for 1 project
    5. Goplan - Online project management app. - Free for 2 projects
    6. Copper Project - Project Management Software.
    7. Side Job Track - Web-based job tracking, invoicing, reporting & project management software.

    Contact Manager

    1. Big Contacts - Web Based Contact Manager for 2 to 2000 People. - Free to 100 contacts
    2. Highrise - Shared contact manager. - Free for 2 users
    3. BatchBook - Easy-to-use contact management system. - 1 user - 200 contacts
    4. Relenta CRM - Small business CRM software. - 1user - 250 contacts
    5. Oprius - Sales and Contact Management Software for Independent Sales Consultants.
    6. PipelineDeals - CRM made simple - $15/User/Month. - Says it's free, but I think it actually will cancel after 30 days.

    Hiring Freelancers

    1. Elance - Outsourcing to Freelancers. - Post for Free
    2. Guru - Free service helps you find freelancers, get free quotes, and get your project done.
    3. SmarterWork - Top small business services marketplace. -
    4. Contracted Work - Work Jobs Freelance Search.
    5. oDesk - Global service marketplace for small and medium sized businesses.
    6. Get A Freelancer - Freelance programmers and web designers.
    7. BizReef - Online Services platform.

    Online Reputation Management Tools

    1. claimID - Free, easy way to manage your online identity.
    2. Google Alerts - Email updates of the latest relevant Google results.
    3. Yahoo Alerts - Free, personalized notification service.
    4. Technorati - Real-time search for user-generated media.
    5. FindMeOn - Manage your circles of friends, family, colleagues and others.
    6. myOpenID - Secure OpenID provider.

    Accepting Payment

    1. PayPal - World renowned.
    2. Google Checkout - Google’s way to send and receive money.
    3. Neteller - Online payment solutions.
    4. Moneybookers - Cheaper way to send and receive money worldwide.
    5. iKobo - Pick up your money at over 1000000 Visa ATMs.
    6. CheckFree - Provides financial electronic commerce services.

    Shopping Carts

    1. Zen Cart - Free, user-friendly, open source shopping cart system.
    2. osCommerce - Free online shop program.
    3. AgoraCart - Free shopping cart.
    4. OpenCart - Open source PHP-based online shopping cart system.
    5. Ubercart - Open source e-commerce suite.
    6. X-Cart - Shopping cart software & PHP ecommerce solutions.
    7. NetSuite - Integrated web-based business software suite.
    8. ZNode - ASP.NET shopping cart.
    9. Fortune3 - Ecommerce Shopping cart software.
    10. Network Solutions - Robust, customizable Ecommerce online shopping cart software.
    11.
    Kick Start Cart - Business professionally over the Internet.
    12. Secure Delivery - The best digital download management site on the net! - Free for 1 product

    Social Networking

    1. PartnerUp - Find business partners, opportunities to get involved in businesses.
    2. Cofoundr - Cofoundr is a private community for entrepreneurs.
    3. Fast Pitch Networking - Business Networking Social Network for Business Professionals.
    4. Killer Startups - Reviewing new startups.
    5. Konnects - Business technology focus groups and networking events.
    6. LinkedIn - Strengthens and extends your existing network of trusted contacts.
    7. Ryze - Business Networking.
    8. StartupNation - Provides real-world business advice to people who want to start a business.
    9. Startupping - Community resource created for Internet entrepreneurs.
    10. UpSpring - Business networking.
    11. Ziggs - White pages and free people search for professionals.

    Finding Funding

    1. GoBigNetwork - Angel investor network/venture capital.
    3. Find That Money - Formidable presence in consumer finance. - Free for very limited trial
    4. Venture Deal - Venture capital database.
    5.
    American Capital Advance - Fast Business Loans.
    6. Financing: Where to Find It

    CPC Revenue - Many in the CPC and CPM section are based on your site traffic volume, etc... but after signup and approval, they all seem to be free from the content publisher standpoint.

    1. Google AdSense - Google’s CPC Network.
    2. Yahoo! Publisher Network - Yahoo’s CPC Network.
    3. ABC Search - Get paid per click by ABC.
    4. AdBrite - Webmasters can buy and sell text ads based on their site’s topic area.
    5. Chitika - The leading merchandising network for bloggers.
    6. Bidvertiser - Pay per click advertising.
    7. Kanoodle - Distributes results to a large network of other search engines and search box providers.
    8. Clicksor - Effective online advertising technology.
    9. Kontera - Advertiser and Publisher Solutions.

    CPM Revenue

    1. ADSDAQ - A new advertising exchange.
    2. ValueClick Media - One of the largest and most effective online advertising networks.
    3. AdDynamix - Full-spectrum interactive provider delivering ad management.
    4. Morning Falls - Online advertising solutions to advertisers and publishers worldwide.
    5. CPX Interactive - Online ad network.
    6. BurstMedia - Internet advertising network.
    7. Casale Media - World’s fastest growing provider of online media solutions.
    8. Tribal Fusion - Focused on high quality sites with targeted content and significant reach.
    9. BrightRoll - Video advertising.
    10. Adtegrity - Internet Advertising Solutions.

     

    posted on 3/12/2008 8:08:53 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [7]
  • Blog reactions