Thursday, January 22, 2009

Errors (501, 403 and 401) while using AppUpdater for a .Net Windows Application

If the error is:
"System.Net.WebException: The remote server returned an error: (501) Not Implemented."
1) Go to IIS and click on Web Server Extentsions and then click on WebDAV and give it the
allow permissions.
2) Check the "directory browsing" checkbox for the update folder from IIS.

If the error is:
"System.Net.WebException: The remote server returned an error: (403) Forbidden."
You have to grant permission on the foll:
1) Script Source Access permission to the update folder.

If the error is:
"System.Net.WebException: The remote server returned an error: (401) Unauthorized."
Cause: Problem can be App.config which will be "ApplicationName.exe" web configuration file.

Solution: Try removing the App.config from updates folder. It should work !! :)

Removing the .config file "works" but may not be the best solution becuase .config files need to be sent as application updates at times. Here's a little theory as to why this error occurs followed by a solution: Files with extentions like .asp, .aspx, .config are treated as scripts. something which IIS is supposed to run/interpret and not just allow users to download in it's raw form. so if you visit an asp you see html returned by asp. Similary if you visit a .config using your browser you see xml output of the .config -however IIS does NOT let you download these files and in a typical web scenario there's no reason why a user should. However, in our case .config is a part of the client application we're trying to download using appupdater and not a typical web/IIS script. So, The solution? You need to do is enable "Script Source Access" on the virtual directory that's hosting your update using IIS admin! That's all you need to do :).


For further details:
Also refer link: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/0b069264-167b-47a4-b312-64aa9bd4c86a/

Wednesday, January 21, 2009

Problems while writing EventLog from ASP.NET Web Application

Problems while Event Log for a Business Logic Layer (BLL) from ASP.NET Web Application

Error:
System.Security.SecurityException: Requested registry access is not allowed.

Grant permission to create a custom event log

  1. Log on to the computer as an administrator.
  2. Click Start, click Run, type regedit in the Open box, and then click OK. The Registry Editor window appears.
  3. Locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
  4. Right-click Eventlog, and then click Permissions. The Permissions for Eventlog dialog box appears.
  5. Click Advanced. The Advanced Security Settings for Eventlog dialog box appears.
  6. In the Name column, double-click the Users group. The Permission Entry for Eventlog dialog box appears.
  7. Select the Set Value check box, select the Create Subkey check box, and then click OK.
  8. Quit Registry Editor, and then log off from the administrator account.
  9. Log on to the computer as a regular user.
  10. Try to create a custom event log by using Visual Studio .NET, and then try to write to this event log by using an application that is built on Visual Studio .NET.

Ref URL:- http://support.microsoft.com/kb/842795