dotnetco.de

How to call a modal popup from backend

There are several ways to call a modal popup from asp.net. You could code it on your own using JavaScript, or you could use existing frameworks like jQuery or Ajax Control Toolkit. As I use both of them, I decided to check with the Ajax Control Toolkit as this is already implemented and no further module needs to be referenced.
You could call the modal popup from the UI or from Backend. The current posting is just a reminder for me how to use it in backend. Continue reading…

Easiest way of asp.net deployment

When it comes to deployment of asp.net projects there are several ways, as described for example on MSDN. Working with ASP.net for several years I’ve found the easiest way of deployment for myself is using zip / rar to pack an archive of updated files. This works very well in both company and personal webserver configuration:

  • In company I’m not allowed to deploy directly to the live server (as this is an admin job)
  • The admin needs to be able to easily deploy the changes to stage server and afterwards to live server.
  • The admin needs to be able to identify the changed files easily.
  • At home I upload the files to my IIS via FTP as that’s easier than connecting to the machine via RDP and starting an update installation.
  • Previously at home with shared hosting I only had access to my webspace via FTP and not via Remote Desktop of course.

Bearing these requests in mind I created a simple batchfile which does this job for me.

The batchfile is available for WinRar and 7-zip but could be modified easily for every packer which supports command-line packing.What it does:

  • It checks the current directory and all subdirectories for modified files.
  • It takes care of an exclusion list so e.g. your source code (*.vb, *.aspx.vb etc.) will not be added to the packed file.
  • It adds current date to the filename of the packed file, e.g. ‘MyFiles20091231.rar’
  • If the packed file already exists it will be deleted first.

Configure before first use:

  1. Set Archivename: Line 25 contains a variable ‘Archivename’. Set this to a name you like, e.g. ‘MyApp%yy%%mm%%dd%.rar’. You might remove the placefolders for current year (%yy%), month (%mm%) and day (%dd%) if you want to have always the same filename, but personally I prefer to have some kind of history, especially as these packed files are normally very small.
  2. Set Path to your packer: Line 31 starts with the filepath of the packer, e.g. ‘”C:\Program Files\WinRar\Winrar.exe”‘. Of course you need to change it if your packer is at another location.
  3. You might take a look at ‘Backup-ExcludeFiles.txt’. That’s an exclusion list, so all files listed here are NOT added to the packed file. You could use single filenames (‘web.config’), wildcards (‘*.zip’) or names of subdirectories (‘TestResults’).
  4. Now place all these files into your local application path, e.g. ‘C:\inetpub\wwwroot\MyApp’.

That’s all for the inital configuration!!

Configuration for every day use:
You’ve made some changes and want to deploy them? Just edit the 4th line of Backup.cmd. It contains a variable ‘LastUpdate’, holding the date and time of the last deployment. You have to edit this on your own. Why is it not computed automatically? Because maybe you made a deployment to stage and then add a bugfix. The new packed file of course also needs the files already deployed to stage, because otherwise you will get a problem while deploying to live. So this date should be the latest modification date for all your environments (local test, stage, live).
Now just start the batch file. You see a new file is created. This file could be forwarded to your admin, uploaded to another documentation system, or extracted locally to upload then via FTP to your (shared) hosting!

Download backup containing Backup.cmd and Backup-ExcludeFiles.txt

Continue reading…

How to use NUnit with Visual Studio Express 2008

One of the important things missing in Microsofts Visual Studio Express Editions is the option to create Unit Tests. Fortunately there are some free Unit Test Tools, like xUnit.netExpressUnit, and lots more. Undoubtedly the best-known Unit Test Tool is NUnit. It’s written in C# and works perfect with current .net Frameworks. Setting up the tests is easy and there are several examples on their webpage, but it’s a bit complicated to get it more convenient. After some hours I faced 2 main questions:

  1. How could I access my app.config for the TestProject dll?
  2. How could I debug my tests?

Fortunately both questions could be answered easily. Continue reading…

The specified domain either does not exist or could not be contacted

I took over an existing application from an external company. They were not available for us anymore, so we only had the source code on our server. I copied all the c-sharp files and created a new webpage project in my VS 2005. When I built the application it worked fine (after some customization), but when it came to access to Active Directory I always got the following error message:
“The specified domain either does not exist or could not be contacted.”

I wondered why it worked on the server and so I searched around. I found 2 tips which finally fixed the problem:
1. I created a default webapplication in IIS, and by default anonymous access to the webpage is enabled. When trying to access AD, the anonymous account is of course not found. So I disabled anonymous account.
2. In web.config I enabled impersonation with this line:  <identity impersonate=”true”> within <system.web>
And now my application runs fine!

Continue reading…

TFS 2005: TF30177: Team Project Creation failed

Today I wanted to add a new Project to my Team Foundation Server (TFS 2005). Unfortunately it did not work as expected. I entered all the data, and then it stops with error message TF30177: Team Project Creation failed. The details contained some more error codes like TF3004: The New Team Project Wizard encountered an unexpected error while initializing the Microsoft.ProjectCreationWizard.Reporting plug-in, TF30171: The Microsoft.ProjectCreationWizard.Reporting plug-in used to create the new team project could not be initialized and returned the following error: TF30224: Failed to retrieve projects from the report server. Checking the supplied logfile shows also TF30207: Initialization for plugin “Microsoft.ProjectCreationWizard.Reporting” failed and System.Net.WebException: Exception Message: The underlying connection was closed: The connection was closed unexpectedly. Continue reading…

There is no source code available for the current location

Of course my code uses some dlls. When I’m in debug mode I then get the message “There is no source code available for the current location”. This is ok for most dlls, but if it’s my own dll I have the source code and could select it. Unfortunately it sometimes happens that I click on ‘Cancel’ and Visual Studio stores it somewhere. Next time i come to this dll I have no option to select the source file again…. so where do I find this option then?

Searching around I found the answer in MSDN at http://msdn.microsoft.com/en-us/library/hdks6de6(VS.80).aspx : It’s stored in the solution! Right click on the solution, select ‘Properties’ and there it is on the ‘Common Properties’ – ‘Debug Source Files’ tab: Do not look for these source files. Remove the entry from there and restart your app. Now you could select the source file again.

Continue reading…