Click here to Skip to main content
15,898,134 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Regular expression in ASP.Net. Pin
ademsandeepreddy2-Nov-09 19:31
ademsandeepreddy2-Nov-09 19:31 
AnswerRe: Regular expression in ASP.Net. Pin
KhandelwalA2-Nov-09 19:32
KhandelwalA2-Nov-09 19:32 
QuestionHow to implement search query in asp Pin
Amit Spadez2-Nov-09 17:49
professionalAmit Spadez2-Nov-09 17:49 
AnswerRe: How to implement search query in asp Pin
sashidhar2-Nov-09 17:55
sashidhar2-Nov-09 17:55 
GeneralRe: How to implement search query in asp Pin
Amit Spadez2-Nov-09 18:02
professionalAmit Spadez2-Nov-09 18:02 
GeneralRe: How to implement search query in asp Pin
Christian Graus2-Nov-09 18:23
protectorChristian Graus2-Nov-09 18:23 
AnswerRe: How to implement search query in asp Pin
sashidhar2-Nov-09 18:12
sashidhar2-Nov-09 18:12 
QuestionAccess is denied. [modified] Pin
I'm a beginner2-Nov-09 17:48
I'm a beginner2-Nov-09 17:48 
Hello all,

I have an asp.net page uploading a file to D driver. It works well with ASP.NET server.
<br />
 protected void Button6_Click(object sender, EventArgs e)<br />
    {<br />
        FileUpload1.SaveAs("D:\\a.txt");<br />
    }<br />


when I published (to IIS) and ran it from IE, it caused an error: Access to the path 'D:\a.txt' is denied as following.

<br />
[UnauthorizedAccessException: Access to the path 'D:\a.txt' is denied.]<br />
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +651<br />
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1038<br />
   System.IO.FileStream..ctor(String path, FileMode mode) +64<br />
   System.Web.HttpPostedFile.SaveAs(String filename) +87<br />
   System.Web.UI.WebControls.FileUpload.SaveAs(String filename) +22<br />
   Examples.Button6_Click(Object sender, EventArgs e) +20<br />
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105<br />
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107<br />
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7<br />
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11<br />
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33<br />
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746<br />
<br />


Best regards,

P/S:
The code for this problem is here:

I have an ASP.NET and this is the code in default.aspx:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="Button6"  runat="server"  önclick="Button6_Click" Text="Button" />
    <br />
    <br />
    </form>
</body>
</html>


And here is the code into default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        FileUpload1.SaveAs("D:\\a.txt");
    }



After compiling the project, I published it as following:
clicked right mouse on it and selected "Publish Website". Then I copy published files to a folder example (a subfolder of C:\Inetpub\wwwroot). Finally, I ran IE and fill in the address: http://localhost/example/default.aspx, clicked button_6, and got the error.

I installed IIS on my local computer with version v5.1

Thanks,

modified on Tuesday, November 3, 2009 4:24 AM

AnswerRe: Access is denied. Pin
_Damian S_2-Nov-09 18:10
professional_Damian S_2-Nov-09 18:10 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 18:20
I'm a beginner2-Nov-09 18:20 
GeneralRe: Access is denied. Pin
Christian Graus2-Nov-09 18:24
protectorChristian Graus2-Nov-09 18:24 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 18:44
I'm a beginner2-Nov-09 18:44 
GeneralRe: Access is denied. Pin
Christian Graus2-Nov-09 18:56
protectorChristian Graus2-Nov-09 18:56 
GeneralRe: Access is denied. Pin
sashidhar2-Nov-09 19:00
sashidhar2-Nov-09 19:00 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 22:08
I'm a beginner2-Nov-09 22:08 
GeneralRe: Access is denied. Pin
Christian Graus2-Nov-09 19:54
protectorChristian Graus2-Nov-09 19:54 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 22:11
I'm a beginner2-Nov-09 22:11 
AnswerRe: Access is denied. Pin
Raja Soosai2-Nov-09 18:42
Raja Soosai2-Nov-09 18:42 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 18:50
I'm a beginner2-Nov-09 18:50 
GeneralRe: Access is denied. [modified] Pin
sashidhar2-Nov-09 19:01
sashidhar2-Nov-09 19:01 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 22:18
I'm a beginner2-Nov-09 22:18 
GeneralRe: Access is denied. Pin
sashidhar2-Nov-09 22:26
sashidhar2-Nov-09 22:26 
GeneralRe: Access is denied. Pin
Christian Graus2-Nov-09 19:28
protectorChristian Graus2-Nov-09 19:28 
GeneralRe: Access is denied. Pin
I'm a beginner2-Nov-09 22:19
I'm a beginner2-Nov-09 22:19 
GeneralRe: Access is denied. Pin
sashidhar2-Nov-09 19:02
sashidhar2-Nov-09 19:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.