One of my current projects requires that my application run from a network share. Not thinking that this would be a problem, I wrote my application and went to deploy it and amazingly, it didn't run. It threw a security error. After some digging I found out that .NET apps don't run with full trust when running from network shares (thankfully, big security problem if they did). They actually don't run with enough trust to even load the main form.
I found a thread that mentioned the solution: http://www.vbdotnetforums.com/showthread.php?t=1224 . Basically you just need to setup the security.config for the machine to grant full trust to your application. You can do it by hand or you can use the CASPOL utility that comes with .NET framework.
Wednesday, February 07, 2007
Config Files and Assemblies in the GAC
Be sure to read the update at the bottom of the post.
The 2.0 version of the .NET has improved the application configuration functionality a lot. Read/Write capability being one of the nicest new features. Combined with Visual Studio 2005’s
new settings dialog, using the app.config has gotten a lot easier.
The 2.0 version of the .NET has improved the application configuration functionality a lot. Read/Write capability being one of the nicest new features. Combined with Visual Studio 2005’s
new settings dialog, using the app.config has gotten a lot easier.
One of the main rules when using the app.config, is that the app.config file has to be in the same folder as its owning dll or exe. Which usually isn’t a problem unless your dll is sitting in the GAC. If you’ve had any experience with the GAC, you know that you can’t just add files to it. It only really accepts .NET dlls.
My current project requires a business layer that will be used by multiple applications, which is a great use of the GAC. There are some settings that will be needed by this business layer. So the question is: How do I get the app.config settings to work with a dll that is stored in the GAC?
It took some figuring out but I found a way. It's not the cleanest way but it works.
Copy your dll to the GAC (however you normally do it)Open command prompt (Start -> Run -> cmd)Change the path to Windows Root Folder\AssemblyDepending on what you have installed Change the path to:.NET 1.0 or .NET 1.1: cd GAC.NET 2.0: cd GAC_MSILIf you dir, you will see a list of all the assemblies installed into the GAC. Cd into your assembly's folderIf you dir again, you will see one folder with your assembly's version and public key token. Cd into this folderIf you dir again, you will be glad to see your assembly.Copy your config file to this folder via the command promptYour application should now be able to locate and use any configuration that you have added to that file.
UPDATED 2: Thanks to commenters on further research, the above option of serialization is not required. All you need to do is setup your settings for the built in app.config funcationality and then use the OpenMappedExecConfiguration method. Example:
Private Shared Function GetConfigurationSection() As Configuration.ClientSettingsSection
Dim codebase As String = System.Reflection.Assembly.GetExecutingAssembly().CodeBase
Dim fileMap As New Configuration.ExeConfigurationFileMap()
Dim p As New Uri(codebase)
Dim localPath As String = p.LocalPath
Dim executingFilename As String = System.IO.Path.GetFileNameWithoutExtension(localPath)
Dim sectionGroupName As String = "applicationSettings"
Dim sectionName As String = String.Format("{0}.My.MySettings", executingFilename)
Dim configName As String = String.Format("{0}.config", localPath)
fileMap.ExeConfigFilename = configName
Dim config As Configuration.Configuration = _
Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, Configuration.ConfigurationUserLevel.None) 'System.AppDomain.CurrentDomain.)
If config IsNot Nothing Then
Dim group As Configuration.ConfigurationSectionGroup = config.GetSectionGroup(sectionGroupName)
If group IsNot Nothing Then
Return DirectCast(group.Sections(sectionName), Configuration.ClientSettingsSection)
End If
End If
Return Nothing
End Function
Sunday, February 04, 2007
Another handy link
CellSwapper is a cool service that helps you find someone to take over you cell phone account by transferring your account to someone else.
http://feeds.feedburner.com/~r/Techcrunch/~3/73811460/
http://feeds.feedburner.com/~r/Techcrunch/~3/73811460/
VMware Converter
Found this news item the other day. This can change a lot how we do things.
http://news.com.com/2110-1010_3-6154353.html?part=rss&tag=2547-1_3-0-5&subj=news
http://news.com.com/2110-1010_3-6154353.html?part=rss&tag=2547-1_3-0-5&subj=news
Sunday, January 21, 2007
Fun App
I just found this cool app. It is an app launcher that has some of the look-and-feel of OSX (or Mac). I'm not usually an OSX nut but this is a handy tool. It's called ObjectDock Plus from Stardock software.
Check it out:
http://www.stardock.com/products/ObjectDock/
The demo version works great for all my needs.
Check it out:
http://www.stardock.com/products/ObjectDock/
The demo version works great for all my needs.
Friday, December 22, 2006
It's been awhile
Sorry it's been so long since my last posts. I just started a new a job and the new company blocks blogger so I have to do my posts at home now. With the new job and Christmas, things have been kind of hectic. I'll try to post stuff as often as possible.
FYI, The new job uses VB.Net as their standard (which I had never done before) so I will start posting fun things I learn about VB.Net as well.
FYI, The new job uses VB.Net as their standard (which I had never done before) so I will start posting fun things I learn about VB.Net as well.
Free Ringtone Maker
I read about a cool little web tool the other day. It let's you upload a audio file and do some edits and download it again as a ringtone. Seems very cool.
I found it here:
I found it here:
Free Ajax Ringtone Maker
Thursday, November 30, 2006
DOMTool
Have you ever wanted to take some html code and have javascript create that same html dynamically?! Trying to do this by hand can be a very tedious process (especially if your html is more than a few lines). Someone has put together a tool that will take your html and produce the javascript that would recreate that html on the fly. A very handy tool...
Here's the Ajaxian.com link to it.
Here's the Ajaxian.com link to it.
Friday, November 17, 2006
Ubuntu
I've been looking for someway to help my in-laws out with their computer for some time now. They have WinXP that was installed several years ago. It really needs to be reinstalled but they don't have any legal way of reinstalling it. While I was pondering their predicament, I read a blog post about Ubuntu. Ubuntu is a Linux-based operating system that focuses on usability. In other words, it is free and easy to use.
I installed it on my desktop to dual boot with my WinXP just to get my feet wet with the OS. The install disk for Ubuntu is actually a live CD and allows you to play with Ubuntu before committing to installing it. The install process was very painless. If you are going to dual boot your system (like I did), I would re-partition your harddrive in the original OS before trying to install Ubuntu (I had a few issues when I tried to get Ubuntu to do it).
The applications and features that come with Ubuntu out of the box would be all that my in-laws would need to replace Windows XP. It also has a very good look and feel that most "simple" users would have no problems getting around in.
Here are some of the things that they constantly use in Windows XP that I have been able to find an equivalent in Ubuntu:
I installed it on my desktop to dual boot with my WinXP just to get my feet wet with the OS. The install disk for Ubuntu is actually a live CD and allows you to play with Ubuntu before committing to installing it. The install process was very painless. If you are going to dual boot your system (like I did), I would re-partition your harddrive in the original OS before trying to install Ubuntu (I had a few issues when I tried to get Ubuntu to do it).
The applications and features that come with Ubuntu out of the box would be all that my in-laws would need to replace Windows XP. It also has a very good look and feel that most "simple" users would have no problems getting around in.
Here are some of the things that they constantly use in Windows XP that I have been able to find an equivalent in Ubuntu:
- Internet Browsing (FireFox)
- CD/DVD burning (built-in to the file explorer)
- Pull images off of a camera (built-in to the file explorer)
- Photo Manager/Editor (FSpot)
- Microsoft Office (OpenOffice)
Wednesday, November 01, 2006
Dynamic DNS
Dynamic DNS is a very neat tool that let's me have domain name associated with the dynamic ip address that I have with my DSL router (more info here). I've been using the Dynamic DNS service offered by DynDNS.com but they only let you use one of their domain names (they do offer a paid version of their service where you can use your own domain name). I was using their domain name of is-a-geek.com which was a pain to type in and it wasn't my own domain.
A coworker pointed me to a Dynamic DNS service that allows you to use your own domain name for free. The service is ZoneEdit.com. I've been using them for a couple of days and I've been impressed with the amount settings they let you control. Their site isn't the prettiest but they have a lot of functionality open to you. Make sure you get their open source IP Address updater client (more info here).
A coworker pointed me to a Dynamic DNS service that allows you to use your own domain name for free. The service is ZoneEdit.com. I've been using them for a couple of days and I've been impressed with the amount settings they let you control. Their site isn't the prettiest but they have a lot of functionality open to you. Make sure you get their open source IP Address updater client (more info here).
Subscribe to:
Posts (Atom)