Meeting the needs of your business from a distance

Streaming files to client in ASP.NET and Compression

by Mark Shiffer 9/4/2008 1:50:00 PM

I recently ran across an issue that took me a while to finally work through. I have a web page that generates a PDF document and streams it down to the browser for viewing. Pretty simple, common functionality. I've done it before without issue. I threw the page together tested it locally in VS and it worked fine. I then copied the page into an existing website (Team System Web Access) and tested from there. What was returned was the pdf document appended with a number of extra bytes that was actually a copy of another area within the document. After a great deal of searching, coding the solution in many different ways, changing IIS7 settings, I finally came to the resolution. In the web.config file for TSWA, it had a compression module that was being used. After I removed that module, the file then came down correctly.

I guess the larger question here is how to get it to work with that compression module still in play. I doubt I will even try that as the module is specific to TFWA and there is not much information available on how it is performing its compression. For reference the line I removed was: <add name="CompressionModule" type="Microsoft.TeamFoundation.WebAccess.CompressionModule" />

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Issues | Programming

Win32: The library, drive, or media pool must be empty to perform this.

by Mark Shiffer 8/4/2008 7:52:00 AM
I recently received this error when programmatically attempting to delete an application pool in IIS. Upon examination of IIS, the system thought the application pool was assigned to a virtual directory that no longer existed. I tried to delete the application pool manually in IIS and received a similar error (worded differently though). I searched through all of the virtual directories on the server and did not find any that were referencing the application pool. Still, IIS was showing the application pool as being assigned to a virtual directory. To get around this, I created a virtual directory with the name that it thought it was already assigned to and assigned the application pool to that new virtual directory. I then unassigned the application pool and was able to delete it. Odd...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Issues

Firefox Compatability...

by Mark Shiffer 3/7/2008 9:49:00 PM

Is a pain in the ass. Yes, I said it, sorry. I know a there are a growing number of people out there using Firefox. Heck, I used to be one of them back when IE sucked, but it doesn't suck anymore. For those who are in Firefox, note that I finally got around to fixing a display issue with Firefox for this blog today. It had to do with a div that I had overflow set to visible on. It worked fine in IE, but in Firefox it caused the div not to stretch with its content. By switching the overflow to hidden, the content then displayed correctly, the div stretched in both IE and Firefox.

My question is, why? Why do different browsers interpret the same code in different ways, when there are, and have been, known standards out there for how to interpret the code? I am hoping IE 8 and its standards by default mode might help the symbiosis here, but come on, we are nearly 20 years into graphical browsers at this point. It shouldn't be this difficult to find these minute display issues.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Issues | Websites | Programming

Hard Drive Failure

by Mark Shiffer 2/4/2008 10:48:00 AM

Well, the hard drive on my main machine started throwing read failures this weekend, and then finally would no longer boot the system because of it. The sucker is only 6-months old from Western Digital. I still have IDE drives that work fine from 10+ years ago. I'm not writing off SATA, but I certainly have had more drive failures recently compared to past history and they've been SATA drives, one at full-time work and one at home. I played a bit of musical chairs with drives at home as I can't wait for the warranty replacement to get back up and running. I moved a 250GB drive that was acting as my network file store out of my server to the client PC and bought a 500GB drive from Circuit City to replace it in the server.

Really this just brought to the forefront my data protection strategies at home. I currently store any data that means anything to me on a central server at home that then gets backed up to a separate (geographical) host every night, encrypting the sensitive data. Unfortunately though, I do not mirror any of my local drives. So, the process of recovering from a failure is still a bit painful. If the drive went out on my server, I would be hurting. I wouldn't lose any data, but it would still be tremendously painful, especially because it is the PDC, SQL Server, Forefront Server and WSUS for my entire network. It has two drives, one being for the server itself and the second being the aforementioned file store for the whole network.  

I'm thinking I should mirror the drive on the server (RAID-1) and then purchase a separate NAS device to use for the central storage. It is too costly to mirror all of the client PCs in the network, but I need to shore up the server. I need to find a drive enclosure that acts as a NAS device and plugs directly into the network. That way I can take the 500GB replacement drive move it to NAS, then take the warranty drive they are sending me and use it for mirroring in the server. Wow it is fun taking care of a home network. Sometimes I wonder if it is truly worth all of the hassle.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Issues

AppDomain and Static Members

by Mark Shiffer 12/12/2007 4:41:00 PM

According to some text I am reading you should avoid having any static members on your MarshallByRef object as they will always execute in the context of the calling AppDomain and not your secondary AppDomain. I would think that could cause some interesting and complicated bugs within your code if you didn't know about that. I am documenting this here for future reference.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Research | Issues

Timers in .NET

by Mark Shiffer 12/6/2007 9:16:00 AM

I am currently tasked with creating a Job Scheduler windows service and have been doing some threading research. I have come to the conclusion that I will be using a Timer to trigger when the next job is to get fired off. (there are plenty of issues in addition to be dealt with here that I will not mention: cache updating, synchronization issues, etc...). .NET has 3 native timer classes as described below. After reading some information from others who have tried unsucessfully to implement Systm.Timers.Timer in a windows service, I have decided to go with the System.Threading.Timer. I will already be dealing with plenty of threading and synchronization issues, so I would like to limit the possibility of chasing down other problems. The System.Threading.Timer is lighter weight than the System.Timers.Timer, however, the System.Timers.Timer has some nice features, such as, the adding/removing of listeners after the timer has been instantiated. I can see why others decided to try to use it in their services.  

Feature description System.Timers.Timer System.Threading.Timer System.Windows.Forms.Timer
Support for adding and removing listeners after the timer is instantiated. Yes No Yes
Supports call backs on the user-interface thread Yes No Yes
Calls back from threads obtained from the thread pool Yes Yes No
Supports drag-and-drop in the Windows Forms Designer Yes No Yes
Suitable for running in a server multi-threaded environment Yes Yes No
Includes support for passing arbitrary state from the timer initialization to the callback. No Yes No
Implements IDisposable Yes Yes Yes
Supports one-off callbacks as well as periodic repeating callbacks Yes Yes Yes
Accessible across application domain boundaries Yes Yes Yes
Supports IComponent – hostable in an IContainer Yes No Yes

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Research | Issues

Visual Studio Team Foundation Server

by Mark Shiffer 11/16/2007 9:27:00 PM

I recently installed Visual Studio Team Foundation Server and I must say this was the worst install experience that I have ever had with a product. Microsoft intertwined this product with so many dependencies and made it so brittle that I am concerned that my move to team for source control was a mistake. However, I am going to give it a shot to see how it works. We are about to make the move at work (full-time job) and figure I should investigate. So far, I am not too impressed with the client. It is missing many key features and/or makes them difficult to accomplish. I'm still at the new stage so we will see how things play out.

 One word of advice for anyone who is installing team server: Read the documentation and carefully follow EVERY step for the installation. Do not deviate, even in the slightest, or you will get burned. It is ridiculous how touchy the install process is. I seriously doubt that I can afford to stay on Team System at home for my source control due to its fragility. Maybe 2008 will be better.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Issues | Programs

Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

by Mark Shiffer 10/16/2007 9:18:00 PM
After moving my projects to a share on the server so that they could be automatically backed up (I have installed source control yet as Team Foundation Server is giving me fits about all sorts of stuff. That is one of the pickiest installs I have ever seen!), I started receiving the following error when I tried to compile my website: "Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." I did a little searching and found that I could add full trust for the share at the machine level to solve the issue. The command was: CasPol.exe -q -m -ag 1.2 -url file://s:\Mark\* FullTrust -n s:\Mark -d "FullTrust granted to: s:\Mark".

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Issues

Force Office 2007 Document to Open in Browser Window on Vista

by Mark Shiffer 10/15/2007 11:02:00 AM

I ran across an issue today that Vista made a bit difficult to get around. It appears that Microsoft removed the option to turn on/off the "Browse in same window" option in Vista for file type associations. In prior versions, to make Internet Explorer show a word or excel document in the browswer instead of opening a new window, one could simply go to Tools..Folder Options, click on the File Types tab, find the file type you wanted to alter and click the Advanced Tab. There was then a check box to allow browsing in the same window or to force office to open the document outside of the browser.

In Vista, file types are altered via Default Programs in the Control Panel, option titled "Associate a file type or protocol with a program". Unfortunately, the advanced options available in prior versions of windows are no longer there. To get around this, the only way I have found thus far is to use regedit and make the following changes for Excel:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.8]
"BrowserFlags"=0

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.12]
"BrowserFlags"=0

To force new windows instead of keeping it in the same window, use 8 instead of 0.

Microsoft has a knowledge base article on this that details the keys for other Office documents as well at:

www.mssoftwareconsulting.com/general/Refer.aspx?url=http://support.microsoft.com/?scid=kb;en-us;162059

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Issues

ODBC Data Sources on 64-bit machines

by Mark Shiffer 10/2/2007 3:16:00 PM

I recently ran into some issues when attempting to run ODBC on a 64-bit machine. The particular ODBC driver I was using installed as a 32-bit driver, and thus had to be accessed through SysWow64\odbcad32.exe. After setting up the data source and running my application, I recieved the error "Data source name not found and no default driver specified" even though it was clearly setup. After doing some digging I found that the application was compiled with the 'Any CPU' option. I am not entirely clear here, but it appears that when the application runs on a 64-bit machine it will run as a 64-bit application and only look at the 64-bit data sources on the machine. If I compile the application with a platform target of x86, and run it on the 64-bit machine it runs and looks at the 32-bit data sources. Problem solved.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Issues

About the author

Name of author Mark Shiffer
CEO & CIO of MS Consulting

E-mail me Send mail

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2009

    Sign in

    Copyright © 2001-2009 MS Consulting, Inc. All Rights Reserved.