登录 | 首页 -> 华新鲜事 -> 社会百科 | 切换到:传统版 / sForum | 树形列表
懂ASP.NET的桐子们,能不能来看看
<<始页  [1]  末页>> 

懂ASP.NET的桐子们,能不能来看看我用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
[MrDJay (7-24 10:19, Long long ago)] [ 传统版 | sForum ][登录后回复]1楼

make your dir executable.C:\Inetpub\wwwroot\ASPNET

set this virtual dir executable in your IIS.

that's enough.
[小诸葛 (7-24 11:19, Long long ago)] [ 传统版 | sForum ][登录后回复]2楼

(引用 小诸葛:make your dir executable.C:\Inetpub\wwwroot\ASPNET set this virtual dir executable in your IIS. that's enough.)thanks butfirst, why it says server not found?

second, even i set that folder as executable, also cannot work...

thanks anyway...
[MrDJay (7-24 11:39, Long long ago)] [ 传统版 | sForum ][登录后回复]3楼

(引用 MrDJay:thanks butfirst, why it says server not found? second, even i set that folder as executable, also cannot work... thanks anyway)Ok,i know le, super sweat~~~~~~~~my testing file is a bit big ....

so it say that err msg

make me blur

i tot it is not that big leh...
[MrDJay (7-24 12:28, Long long ago)] [ 传统版 | sForum ][登录后回复]4楼


<<始页  [1]  末页>> 
登录 | 首页 -> 华新鲜事 -> 社会百科 | [刷新本页] | 切换到:传统版 / sForum