Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I attach wndproc to another window and do something when certain wm_event appears ? Pin
Dave Kreskowiak27-Jul-12 2:13
mveDave Kreskowiak27-Jul-12 2:13 
GeneralRe: How can I attach wndproc to another window and do something when certain wm_event appears ? Pin
Member 964871827-Jul-12 3:54
Member 964871827-Jul-12 3:54 
GeneralRe: How can I attach wndproc to another window and do something when certain wm_event appears ? Pin
Dave Kreskowiak27-Jul-12 15:28
mveDave Kreskowiak27-Jul-12 15:28 
QuestionStrange behaviour on C# app in Windows 7... Pin
shiokbarnabas26-Jul-12 20:09
shiokbarnabas26-Jul-12 20:09 
AnswerRe: Strange behaviour on C# app in Windows 7... Pin
Dave Kreskowiak27-Jul-12 2:25
mveDave Kreskowiak27-Jul-12 2:25 
GeneralRe: Strange behaviour on C# app in Windows 7... Pin
shiokbarnabas29-Jul-12 22:01
shiokbarnabas29-Jul-12 22:01 
GeneralRe: Strange behaviour on C# app in Windows 7... Pin
Dave Kreskowiak30-Jul-12 1:59
mveDave Kreskowiak30-Jul-12 1:59 
GeneralAccess to the path is denied Pin
Arunkumar.Koloth26-Jul-12 3:35
Arunkumar.Koloth26-Jul-12 3:35 
Hello everyone

This is a program for downloading a file from a url
when i download a file i got a error like access to the path is denined can any one tell me why this happen

This is my code.
<pre lang="c#">
        public static void Download(String strURLFileandPath, String strFileSaveFileandPath)
        {
            HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(strURLFileandPath);
            HttpWebResponse ws = (HttpWebResponse)wr.GetResponse();
            Stream str = ws.GetResponseStream();
            byte[] inBuf = new byte[100000];
            int bytesToRead = (int)inBuf.Length;
            int bytesRead = 0;
            while (bytesToRead > 0)
            {
                int n = str.Read(inBuf, bytesRead, bytesToRead);
                if (n == 0)
                    break;
                bytesRead += n;
                bytesToRead -= n;
            }
            try
            {
                
                FileStream fstr = new FileStream(strFileSaveFileandPath, FileMode.OpenOrCreate, FileAccess.Write);
                fstr.Write(inBuf, 0, bytesRead);
                str.Close();
                fstr.Close();
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            
        }



        private void button2_Click(object sender, EventArgs e)
        {
            if (phpurl.Text == "") {
                MessageBox.Show("Invalid Url");
            }
            else if (Uri.IsWellFormedUriString(phpurl.Text, UriKind.Absolute) == false)
            {
                MessageBox.Show("Invalid Url");
            }
            else {
                Download(phpurl.Text, @"D:\test");
            }

            
        } 

Also this is my manifest file
XML
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
  
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->

      <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
      <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
      
    </application>
  </compatibility>
  
  <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
  <!-- <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>-->

</asmv1:assembly>



Please help me..
Confused | :confused: Confused | :confused: Confused | :confused:
Thanks in advance.

GeneralRe: Access to the path is denied Pin
Eddy Vluggen26-Jul-12 3:47
professionalEddy Vluggen26-Jul-12 3:47 
GeneralRe: Access to the path is denied Pin
Dave Kreskowiak26-Jul-12 3:51
mveDave Kreskowiak26-Jul-12 3:51 
GeneralRe: Access to the path is denied Pin
Arunkumar.Koloth26-Jul-12 5:17
Arunkumar.Koloth26-Jul-12 5:17 
GeneralRe: Access to the path is denied Pin
dybs26-Jul-12 5:42
dybs26-Jul-12 5:42 
GeneralRe: Access to the path is denied Pin
Arunkumar.Koloth26-Jul-12 5:49
Arunkumar.Koloth26-Jul-12 5:49 
GeneralRe: Access to the path is denied Pin
Dave Kreskowiak26-Jul-12 6:51
mveDave Kreskowiak26-Jul-12 6:51 
GeneralRe: Access to the path is denied Pin
Arunkumar.Koloth26-Jul-12 17:51
Arunkumar.Koloth26-Jul-12 17:51 
GeneralRe: Access to the path is denied Pin
Arunkumar.Koloth27-Jul-12 1:24
Arunkumar.Koloth27-Jul-12 1:24 
GeneralRe: Access to the path is denied Pin
Dave Kreskowiak27-Jul-12 2:08
mveDave Kreskowiak27-Jul-12 2:08 
GeneralRe: Access to the path is denied Pin
ignrod27-Jul-12 1:52
ignrod27-Jul-12 1:52 
GeneralRe: Access to the path is denied Pin
Arunkumar.Koloth27-Jul-12 2:08
Arunkumar.Koloth27-Jul-12 2:08 
GeneralRe: Access to the path is denied Pin
ignrod27-Jul-12 2:36
ignrod27-Jul-12 2:36 
QuestionProblems Running an Executable... Pin
glennPattonWork326-Jul-12 3:08
professionalglennPattonWork326-Jul-12 3:08 
AnswerRe: Problems Running an Executable... Pin
Eddy Vluggen26-Jul-12 3:34
professionalEddy Vluggen26-Jul-12 3:34 
GeneralRe: Problems Running an Executable... Pin
glennPattonWork326-Jul-12 3:42
professionalglennPattonWork326-Jul-12 3:42 
GeneralRe: Problems Running an Executable... Pin
Eddy Vluggen26-Jul-12 6:40
professionalEddy Vluggen26-Jul-12 6:40 
GeneralRe: Problems Running an Executable... Pin
glennPattonWork327-Jul-12 0:17
professionalglennPattonWork327-Jul-12 0:17 

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.