Bill Morefield My thoughts, discoveries, and occasional rambiings.

May 10, 2010

Fixing Windows 2003 ASP.NET Tab Doesn’t Show in IIS

Filed under: Uncategorized — Bill Morefield @ 11:27 pm

I ran into an issue this evening and wanted to document it for my own future reference and anyone else who might run into the problem.  I had installed ASP.NET 4 onto a Windows 2003 64 bit server.  I uploaded a test version of an application that is a port of an existing application converted to take advantage of some of the new features of .NET 4.  After loading the application and setting it as an application I noticed that the ASP.NET tab where one would normally change the version wasn’t there.

After some false starts, I came across this blog post which describes much the same issue though my server was not running on VMWare, but another virtualization system.  The fix it suggests is:

  1. Stop IIS
  2. Edit the MetaBase.XML file in %WINDIR%system32inetsrv to remove a line reading Enable32BitAppOnWin64="TRUE"
  3. Start IIS

I did this and the tab did appear, but the result caused more problems that it solved.  Several components on the web site refused to load under 64 bit only and as a result the server was useless.  After changing the settings back to where they had been to start I looked some more and found another blog post that gave an alternative solution to “manually” change the version on a directory using the aspnet_regiis tool.  To do this you use the –s or –sn options along with the path of the application.  The path is not the path to the application on disk, but a application path that goes something like W3SVC/[x]/ROOT/AppPath where [x] is the number of the web site (shown on the listing of all the web sites in the IIS Manager) and the AppPath is the path from the root of the site to the application you want to set.  The difference between the two options is that –s applies the change to the path you specify and any applications located below it while –sn only changes the settings of the application at the path and does not affect applications below it.

A good note is that an MVC 2 application no longer requires the wildcard mapping “hack” under IIS 6 with ASP.NET 4.  Also make sure to allow ASP.NET 4 in the Extensions for your new web application to work too.

April 10, 2010

A Thought About Apple and Adobe

Filed under: Uncategorized — Bill Morefield @ 1:14 pm

Today I read some articles about the changes to the agreement for the iPhone SDK that basically seems designed to keep Flash off the iPhone at all costs.  I’m more annoyed that it might knock out MonoTouch, a product I was starting to look at with the idea of doing some iPhone/iPad development, though the company still seems optimistic.

If Adobe really decides to push it, here is an interesting thought.  Adobe’s new Creative Suite 5 debuts in on Monday.  What if Adobe was to decide that if Flash can’t go onto the iPhone, then Creative Suite won’t be released for the Mac?  It’s a nuclear option to be sure as it would get the Mac creative community up in arms, but I can’t think of a better weapon they have in their arsenal if they really wanted to push the fight.  It’s probably too late for CS5 even if they wanted to, but imagine if during the debut they mentioned that they were reevaluating their support for CS6 on the Mac platform given the current relationship with Apple.

I think it would be a bad idea in the long run for Adobe, but it’s an interesting thought.

March 24, 2010

Fixing Windows Mobile Email Account There, But Not Able To Access It

Filed under: Uncategorized — Bill Morefield @ 2:35 pm

I woke up this morning to a rather odd issue on my phone. I have a Windows Mobile phone and use it to check several email accounts. This morning one showed up on the list, but didn’t seem to have synchronized since late last night. So I went into Pocket Outlook and the account doesn’t even show up. I then go to Messaging and do not see the account. Thinking it one of those odd errors or that I’d accidently deleted it the night before while changing some settings, I started to add the account back in only for the phone to tell me it already existed.

 

So at lunch I began searching for the problem and most solutions said just hard reset the phone. That’s basically means erasing it and reinstalling everything. Right now I just don’t have that kind of time. So I looked a little more and found a link to a tool called MailAccountRepair at http://nicolasmauri.blogspot.com/2007/01/wm5-utility-recover-your-lost-mail.html. It was written for Windows Mobile 5 and isn’t supported in any way, but given the alternative was to reset the phone and spend a few hours reinstalling and reconfiguring it this evening, I decided to give it a try. It worked for me so it appears to at least fix the problem in some cases.

March 23, 2010

Site Problems are Now Fixed

Filed under: Uncategorized — Bill Morefield @ 12:36 am

I found out tonight that my site has been down for much of the last week because of a server move by the host.  I made the mistake of believing them when they said all my settings should move over instead of checking myself.  I lost a post along the way that I’ll get back up tomorrow, but for now I think all is well again.

March 11, 2010

Windows Home Server and Bad Patches

Filed under: Uncategorized — Bill Morefield @ 9:48 pm

I purchased a HP Mediasmart Ex490 back in the fall and until late last week have loved it.  Then late last week I tried to remote into it and found the server ran glacially slow.  I then used Remote Desktop to directly connect  to the desktop (the Windows Home Server Console is really just a remote desktop than runs a single application.  When you remote desktop in normally a shortcut to that application is on the desktop) and saw the CPU was pegged to 100% and the guilty application was the Twonky Media server.  This software lets me stream the music and video files from my server out to other devices on the network.

 

Some research confirmed this was the culprit as a few other people were complaining about it.  It turns out a patch had installed the problem version of the application.  For the short term I just stopped the TwonkyMedia service (Start –> All Programs –> Administrative Tools –> Services).  This accomplishes the same thing as using the Stop Sharing button in the Media Server tab of the Console, but was much faster to bring up.  Once I did this the server load returned to normal.

 

I finally had a chance to come back to this tonight and found a way to get the server back to normal at http://www.mediasmartserver.net/2010/03/04/how-to-fix-twonky-issues-in-3-0-patch-2/.  The only thing I’d add to it is that stopping and starting Twonky through Services works to move the offending file and responds much faster than the Console does with the CPU pegged.

 

Now HP, how about getting a fix out soon?

February 7, 2010

Fixing Unrecognized USB Hub

Filed under: Uncategorized — Bill Morefield @ 3:30 pm

I spent a few hours this week troubleshooting this and hopefully this will help anyone who comes across it

I built a new desktop machine between Christmas and New Year’s at the end of last month.  Earlier this week the Belkin USB hub that I’d had to RMA arrived back and I hooked it up only to find that it didn’t work.  I plugged it into my laptop and it came up with no problems so I knew it had to be something with the computer and not the device.  Since both machines were running Windows 7 64-bit edition, I felt it should be something fixable.

I tried Google and didn’t find anything so I had to put it off until this weekend when I had a chance to better look at the problem.  The first I place that I go anytime hardware doesn’t work is Device Manager.  There I saw something that caught my attention, a Bluetooth device that I didn’t remember being there before named “Bluetooth USB + EDR Adapter Class1 v2.1”.  It also had the little yellow triangle that means it’s not working.  To verify this was my hub, I right clicked on it, select Uninstall.  Then I disconnected the hub and then reconnected it.  Sure enough the device returned.  So now I knew my problem, the hub was not being recognized as a hub it appeared, but instead as a Bluetooth radio.

After searching both Google and Bing again using the incorrect device name I found some interesting articles saying a Windows Update might be the cause, but in my case apparently not as there are no updates on the laptop where it worked compared to the desktop where it does not.  The fixes in those articles didn’t work in any case.

So in the end I decided to try setting the driver to a generic USB hub to see if it would work.  To do this, I right-clicked on the device and chose Properties and then went to the driver tab and then the Update Driver button.  The key is not to let Windows do it, but pick the Browse my computer for driver software option which will let you choose the driver.

 image5

 

 

 

 

 

 

 

Now if this was some specialized device, I would then pick a directory where I’d extracted a driver from the manufacturer’s web site, but with a USB hub, I just need the generic USB driver so I use the Let me pick from a list of device drivers on my computer.

image8

 

 

 

 

 

 

 

With the show compatible hardware option selected to filter out the irrelevant drivers, I saw two options.  The first was the device that had wrongly been selected.  The next was Generic USB Hub which is exactly what I wanted.  So I select that and click Next.

 image11

 

 

 

 

 

 

 

Windows then installed the driver and the hub is working perfectly now.  In effect when Windows doesn’t recognize a device correctly, sometimes you just have to tell it what to do.

November 9, 2009

Verizon Update

Filed under: Uncategorized — Bill Morefield @ 7:28 pm

I had some issues with Verizon, mostly with the store where I set up service, but the network coverage is definitely much better.  I finally settled on the HTC Touch Pro 2.  I’ve used Windows phones for quite a while and I’ll definitely agree it has issues, I’ve got a large investment in software for the Windows Phone platform that it will take a big clear advantage to make me move.  I do admit that the Droid was tempting, but I just saw one deal breaker for me so I stayed on the Windows Mobile.  After I’ve had the phone a little longer, I’ll post some thoughts.

October 14, 2009

AT&T – It’s Not Me, It’s You

Filed under: Uncategorized — Bill Morefield @ 5:59 pm

I’ve had my cell phone service with AT&T for so long, I can’t remember exactly when I signed up with them.  I do know it was still called BellSouth Mobility at the time.  In truth I’m a little sad at this, but I’ve had it with them and am moving to Verizon.

I still think AT&T has the best phones overall, but their network has serious issues.  I purchased a new phone late last year which was my first in several years.  My old phone didn’t support 3G and assumed that many of my problems were related to that.  I now know how most of the time I never even see 3G and at my house there are many places where I leave my phone and get little or no signal and I live less than two miles from the Interstate and just outside a small city.

So I’m currently I’m giving Verizon a try and will see how they do.

September 19, 2009

FCKEditor under ASP.NET MVC

Filed under: Uncategorized — Bill Morefield @ 2:00 pm

Often in a web application, I’ve found the need to let a non-technical user enter rich HTML style text into a form or control. I’ve been working on a medium scale application in ASP.NET MVC for the last few weeks and found myself needing the ability to do just this. In the past I’ve used the FCKEditor to do just this. I like this editor over many of its competitors because it includes the ability to upload files and images directly instead of having a third party program to do this. Note that in the newest version (renamed CKEditor 3.0) the file browser component has been split into a separate pay component.

I spent some time online and found a few articles on doing this. One I found on CodeProject was a bit outdated, but had some good information and a blog entry by Stefan Kamphuis had a good and working implementation, but didn’t cover all the features of the editor. It took me a couple of days of off and on work to get everything working so I’m going to document the process for my own reference and to help anyone else trying to do this.

As I mentioned above, the file browser component is now a pay component in the newest version so we’ll be using the latest in the 2.x line, FCKeditor 2.6.4.1. You’ll also need the FCKeditor.Net 2.6.3 package both of which can be downloaded from the CKEditor web site. Unzip both into a directory.

First we’ll create a blank ASP.NET MVC application in Visual Studio 2008 and get the editor control working . Copy the fckeditor folder that you unzipped from the FCKeditor_2.6.4.1.zip package into your application. I like to create a folder under Content called js and then place the fckeditor folder in there. You can delete everything out of this directory except the editor subfolder and two files: fckconfig.js and fckeditor.js files.

Next open up the Index.aspx file under our Views / Home folder. We’ll start by adding a textbox to this view that will become our rich text box. Add this line to the page.

<%= Html.TextArea("fckeditor", "", new { @name="fckeditor" })%>

Note that we are setting the name of the control to match the ID which is important.

Next we need to add a reference to the JavaScript files that we added to our project that actually implements the rich editor. This is done by adding the following line somewhere on the page.

[js]<script src="<%= Url.Content("~/Content/Js/fckeditor/fckeditor.js") %>" type="text/javascript" ></script>[/js]

And now we add the script to replace our standard text editor with the rich editor. Add this to the page below the script call above.

[js]
<script type="text/javascript"> window.onload = function() { var sBasePath = ‘<%= Url.Content("~/Content/Js/Fck/") >’;

var oFCKeditor = new FCKeditor( ‘FckEditor1’ ) ;

oFCKeditor.BasePath = sBasePath ;

oFCKeditor.ReplaceTextarea() ;

} </script>
[/js]

By default the framework will throw an error if you submit the form as it is now. The error “A potentially dangerous Request.Form value was detected from the client” is telling you that one of the items on the form contains HTML characters. To stop this, we need to turn off this checking. The easiest way to do this is by adding the following attribute to the action on the controller:

[csharp][ValidateInput(false)][/csharp]

At this point we have a rich control that can post text back. Next let’s get the file browser and upload component working. First we add a reference to the asp.net library that we also downloaded. There are several files in the zip file, but the file we need to reference is the FredCK.FCKeditorV2.dll located in binRelease2.0. This file implements the server logic.

Next we need to create a folder that will hold the content that users will be allowed to upload. I’m going to create this folder under the Content folder and call it usercontent. This folder must be granted the appropriate permission if you’re going to allow users to upload. Under most newer web servers giving the Network Service read/write/modify permission to the folder will do this.

Now back in our fckeditor folder we need to modify the fckconfig.js file to tell it that we’re going to use the ASP.NET server side component that we just referenced. Look for the two lines:

[js]
var _FileBrowserLanguage        = ‘php’ ;        // asp | aspx | cfm | lasso | perl | php | py

var _QuickUploadLanguage        = ‘php’ ;        // asp | aspx | cfm | lasso | perl | php | py
[/js]

and change them to

[js]
var _FileBrowserLanguage        = ‘aspx’ ;        // asp | aspx | cfm | lasso | perl | php | py

var _QuickUploadLanguage        = ‘aspx’ ;        // asp | aspx | cfm | lasso | perl | php | py
[/js]

Now we need to configure the server component to set up some security and to let it know where we want the content to be located. The file that we need to find is located under the fckeditor folder in fckeditor/editor/filemanager/connectors/aspx named config.ascx.

First we need to modify the CheckAuthentication() function to control who we want to use this component. You can simply change the function to always return true, but as the comments note, this is a really bad idea and will basically let anyone upload content to your site. That’s just begging to be hacked. More likely you will only want certain users or certain roles to be able to do this. You could also check a user’s role or do any checks that you want and return true or false as needed. For example if you want to allow any authenticated user then we can change the line to:

[csharp]return HttpContext.Current.Request.IsAuthenticated;[/csharp]

This will return true for any users who are logged in and false for anonymous users.

Lastly we need to set where our content will be located (the folder that we created a little earlier) The two lines that we need to change are:

[csharp]UserFilesPath = VirtualPathUtility.ToAbsolute("~/Content/usercontent/");[/csharp]

and

[csharp]UserFilesAbsolutePath = HttpContext.Current.Server.MapPath("~/Content/usercontent/");[/csharp]

There are some other settings here that you can change to control where and what users can upload, but this should get the basics of the editor working.

September 2, 2009

Renaming Folder Names from _svn to .svn in Subversion

Filed under: Uncategorized — Bill Morefield @ 6:26 pm

At one time Visual Studio didn’t like folders that started with a period.  Unfortunately Subversion uses a folder name .svn to store information by default.  As a workaround most Subversion and Subversion clients for Windows allowed users to set an environment variable (and the TortiseSVN client would do this for you) to use and underscore in place of the period so .svn became _svn.

So tonight I was getting around to finally setting up the development environment on my new Windows 7 laptop (and so far I love it) and moving the projects backed up from my old machine to my new one.  When I opened one up to work on it, I found that it didn’t seem to recognize that it was a local copy of a project.  Some investigation showed that the old laptop had this variable set, so it was looking for _svn instead of .svn for the information.

Most likely when I moved to my last laptop I set this variable as I still had one old ASP.NET 1.1 project that I maintained and simply left it that way even though I haven’t touched the project in two years.  Or I just set the variable so that the old files that had already been checked out with the variable set on its predecesor would work.  Now though I wanted to make a change and it seemed there had to be an easier way than going through all the sub folders in each project, unhiding each _svn folder, renaming it, and then hiding the renamed .svn folder back.

Sure enough at this site I found a batch file to do just that.  The back file is simply:

FOR /R %%f IN (_svn) DO IF EXIST "%%f" (
ATTRIB -h "%%f"
RENAME "%%f" .svn
ATTRIB +h "%%f"
)

I repeat the warning on that page that it works for me, but you use at your own risk.

« Newer PostsOlder Posts »

Powered by WordPress