懂ASP.NET的桐子们,能不能来看看
所在版块:社会百科 发贴时间:2003-07-24 10:19

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
我用ASP.NET写了个小小的File uploading program

但是每次我click upload时,都会显示

the page cannot be displayed.

大家帮我看看为什么……


我把

代码 和 错误信息贴在这里哈


many thanks~~~
-----------------upload.aspx---------------------------------

<%@ Page Language="C#" Inherits="UpFile"&nbsp;Src="uploader.cs"&nbsp;%>
<html>
<head>
<title>
Uploader
</title>
</head>
<body>

<form method = "post" enctype = "multipart/form-data" runat ="server">
<input id="IoFile" type = "file" runat= "server">
<input type = "submit" id = "submit" Value = "Upload Now!" OnServerClick = "UploadFile_OnClick" runat = "server">
<br>
</form>
</body>
</html>


------------------uploader.cs----------------------------------

using System;
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;

public class UpFile : Page
{

protected HtmlInputFile IoFile;
protected String IstrFileName;
protected String IstrFileNamePath;
protected String IstrFolder;

public void UploadFile_OnClick(Object Sender,EventArgs e)
{
//IstrFolder = "F:\\phpdev\\www\\public\\UploadedFiles\\";
IstrFolder = @"C:\Inetpub\wwwroot\dev\lockers\NewBalloting";

IstrFileName = IoFile.PostedFile.FileName;
IstrFileName = Path.GetFileName(IstrFileName);

IstrFileNamePath = IstrFolder + IstrFileName;
IoFile.PostedFile.SaveAs(IstrFileNamePath);
}
}



---------------------Error--------------------------

Erro Mesg One: when choose file , then click the button

it will be:

The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

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

Please try the following:

Click the Refresh button, or try again later.

If you typed the page address in the Address bar, make sure that it is spelled correctly.

To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP).
If your Network Administrator has enabled it, Microsoft Windows can examine your network and automatically discover network connection settings.
If you would like Windows to try and discover them,
click Detect Network Settings
Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed.
If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0.
Click the Back button to try another link.



Cannot find server or DNS Error
Internet Explorer

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

if I just click the upload button:


it will be

Server Error in '/' Application.
--------------------------------------------------------------------------------

Access to the path "C:\Inetpub\wwwroot\ASPNET" 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\ASPNET" 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[UnauthorizedAccessException: Access to the path "C:\Inetpub\wwwroot\ASPNET" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode) +52
System.Web.HttpPostedFile.SaveAs(String filename) +48
UpFile.UploadFile_OnClick(Object Sender, EventArgs e) +124
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +108
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Ever Thine, Ever Mine, Ever Ours
 相关帖子 我要回复↙ ↗回到正文
懂ASP.NET的桐子们,能不能来看看 MrDJay   (5678 bytes , 310reads )
make your dir executable. 小诸葛   (87 bytes , 198reads )
thanks but MrDJay   (121 bytes , 138reads )
Ok,i know le, super sweat~~~~~~~~ MrDJay   (104 bytes , 145reads )