database backup error

  • I have a webform to manage sql express 2005 backups.

    If i test the application with the debugger and click the button to made a backup, everything works ok and the backup is created inside my web application folder. When i run the web app under IIS, if I try to do the backup i recieve the following error:

    Server Error in '/test' Application.

    --------------------------------------------------------------------------------

    User does not have permission to perform this action.

    User does not have permission to perform this action.

    Processed 416 pages for database 'test', file 'test' on file 5.

    Processed 3 pages for database 'test', file 'test_log' on file 5.

    BACKUP DATABASE successfully processed 419 pages in 0.754 seconds (4.543 MB/sec).

    I have included the \ASPNET user in my database with

    schema 'dbo' and 'db_owner' permission. I have also change the security directives of the folder where the backup is going to be saved (write permission,creation,etc..) but it doesn´t work.

    The stored procedure i execute is the following:

    ***************************************************************************

    CREATE PROCEDURE [dbo].[AI_DoBackup]

    (

    @path nvarchar(130) --the physical path of the web app

    )

    AS

    BEGIN

    --if the logic device exixts, delete it

    IF EXISTS (SELECT name FROM master.dbo.sysdevices WHERE name = 'test')

    BEGIN

    EXEC sp_dropdevice 'test'

    END

    DECLARE @ruta NVARCHAR(260)

    DECLARE @fileNVARCHAR (50);

    SET @file='backups\test_' + CONVERT(VARCHAR, GETDATE(), 112) + '.bak.'

    SET @ruta = @path + @file

    --create logic device

    EXEC sp_addumpdevice 'disk', 'test', @ruta

    --do the full backup

    BACKUP DATABASE TestDemo TO test

    *************************************************************

    Any Idea??

  • I'd remove the ASPNET user and add the anonymous user in IIS. See if that account works.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply