PDA

View Full Version : مشکل از چیه (روی سرور دایرکتوری نمی سازد)



kochol
شنبه 09 آبان 1383, 14:12 عصر
سلام اشکال این سورس چیه

Private Sub butCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butCreate.Click
Dim strPath As String
strPath = Server.MapPath(Request.ApplicationPath) & "\" & txtName.Text
If Directory.Exists(strPath) Then
litnameexist.Text = "<p>The name " & txtName.Text & _
" already exists. Please choose a different one.</p>"
Return
Else
Try
Directory.CreateDirectory(strPath)
Session("Path") = strPath
Server.Transfer("filemanager.aspx")

Catch ex As System.UnauthorizedAccessException
' Server.Transfer("NotAuthorized.aspx")
End Try
End If
End Sub
دایرکتوری نمی سازه

Vahid_Nasiri
شنبه 09 آبان 1383, 18:22 عصر
Try و Catch را حذف کن و بعد عکس خطای حاصل در مرورگر وب را اینجا قرار بده تا مشخص بشه مشکل از کجاست.

kochol
شنبه 09 آبان 1383, 21:21 عصر
Server Error in '/test01/WebTextEditor' Application.
--------------------------------------------------------------------------------

Access to the path "d:\inetpub\wwwroot\test01\WebTextEditor\akbar" 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 "d:\inetpub\wwwroot\test01\WebTextEditor\akbar" 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:


Line 39: Return
Line 40: Else
Line 41: Directory.CreateDirectory(strPath)
Line 42: Session("Path") = strPath
Line 43: Server.Transfer("filemanager.aspx")


Source File: d:\inetpub\wwwroot\test01\WebTextEditor\NewAccount .aspx.vb Line: 41

Stack Trace:


[UnauthorizedAccessException: Access to the path "d:\inetpub\wwwroot\test01\WebTextEditor\akbar" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path) +632
System.IO.Directory.CreateDirectory(String path) +195
WebTextEditor.newaccount.butCreate_Click(Object sender, EventArgs e) in d:\inetpub\wwwroot\test01\WebTextEditor\NewAccount .aspx.vb:41
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
البته من در اولین خط
imports system.io رو وارد کردم

Vahid_Nasiri
یک شنبه 10 آبان 1383, 18:00 عصر
برنامه های asp.net تحت مجوز یوزر aspnet اجرا می شوند. این یوزر باید دسترسی write روی این فولدر داشته باشد تا بتواند دایرکتوری ایجاد کند. روی دایرکتوری برنامه کلیک راست کنید. در قسمت Security یوزر aspnet را add کنید و تمام مجوزهای لازم را به آن بدهید تا مشکل حل شود.

kochol
سه شنبه 12 آبان 1383, 14:42 عصر
لطفا بیشتر توضیح بدید من نفهمیدم

Vahid_Nasiri
سه شنبه 12 آبان 1383, 16:06 عصر
کدوم قسمت رو متوجه نشدید؟

saniak_robot
شنبه 13 خرداد 1385, 15:18 عصر
سلام
من این تنظیمات رو هم انجام دادم ولی بازم همین ارور رو میده . لطفا کمک کنید :متعجب: :گریه: