懂ASP.NET的桐子们,能不能来看看
登录 | 论坛导航 -> 华新鲜事 -> 社会百科 | 本帖共有 4 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:MrDJay (等级:10 - 炉火纯青,发帖:10172) 发表:2003-07-24 10:19:45  楼主  关注此帖
懂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
Ever Thine, Ever Mine, Ever Ours
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表
作者:小诸葛 (等级:2 - 初出茅庐,发帖:41) 发表:2003-07-24 11:19:31  2楼
make your dir executable.
C:\Inetpub\wwwroot\ASPNET

set this virtual dir executable in your IIS.

that's enough.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表
作者:MrDJay (等级:10 - 炉火纯青,发帖:10172) 发表:2003-07-24 11:39:59  3楼
make your dir executable.C:\Inetpub\wwwroot\ASPNET set this virtual dir executable in your IIS. that's enough.
thanks but
first, why it says server not found?

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

thanks anyway...
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表
作者:MrDJay (等级:10 - 炉火纯青,发帖:10172) 发表:2003-07-24 12:28:11  4楼
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...
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表
论坛导航 -> 华新鲜事 -> 社会百科 | 返回上一页 | 本主题共有 4 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码