powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Гемморой с XML
4 сообщений из 4, страница 1 из 1
Гемморой с XML
    #33373548
vitaliy14
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Случилась такая проблема:

есть код который записывает в xml - файл данные

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
Public Sub WriteXml()
        Dim doc As New XmlDocument
        Dim RootElement, IDElement As XmlElement
        Dim xmlAtrib As XmlAttribute
        Dim Declar As XmlDeclaration
        Dim comment As XmlComment
        Dim i, n, res As Integer
       

        Declar = doc.CreateXmlDeclaration("1.0", Nothing, "yes")

        doc.InsertBefore(Declar, doc.DocumentElement)
        comment = doc.CreateComment("Create with the XmlDocument class ")
        doc.InsertAfter(comment, Declar)

        RootElement = doc.CreateElement("ArrayKvit")
        doc.InsertAfter(RootElement, comment)

        n = _ID.Length

        For i =  0  To n -  1 
            res = _ID(i).ToString
            IDElement = doc.CreateElement(_CartID)
            IDElement.InnerText = res.ToString
            RootElement.AppendChild(IDElement)
        Next

                doc.Save("C:\Inetpub\wwwroot\RegDB\ArrayKvit.xml")
        
End Sub


при нажатии кнопки на моей странице запускается этот код и данные записываются в файл , но вместо записи возникает ошибка

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
Access to the path "C:\Inetpub\wwwroot\RegDB\ArrayKvit.xml" is denied. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.UnauthorizedAccessException: Access to the path "C:\Inetpub\wwwroot\RegDB\ArrayKvit.xml" is denied. 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS  5  or Network Service on IIS  6 ) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:  и так далее 

В чем может быть проблема и как ее решить? самое поразительное, что вчера на моем ноутбуке все работало великолепно и я был очень счастлив. Стоило проект перенести на рабочий компьютер как все перестало работать!!!!!
...
Рейтинг: 0 / 0
Гемморой с XML
    #33373558
Фотография vladgrig
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
права на запись в настройках приложения на сервере поставь...
...
Рейтинг: 0 / 0
Гемморой с XML
    #33373565
vitaliy14
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
в iis в свойствах проекта я поставил права на запись (галочку)... может до него плохо доходит?
...
Рейтинг: 0 / 0
Гемморой с XML
    #33373574
Фотография vladgrig
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
тогда вот это
Код: plaintext
1.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Гемморой с XML
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]