-1

I want to open folder from web page by clicking on a button ... In my code when I am use a hyper link its working properly. but when I am using a button its not working.

here is my code:

 protected void Button1_Click(object sender, EventArgs e)
    {
      Response.Redirect("file://LAP6//C$");

    }

Can you provide me some C# code for this functionality. Thanks

Waqas
  • 6,812
  • 2
  • 33
  • 50
Chandan Sarkar
  • 11
  • 1
  • 1
  • 2
  • [this](http://stackoverflow.com/questions/6248702/redirecting-new-tab-on-button-click-response-redirect-in-asp-net-c-sharp) might help – 0xBADF00D Jan 25 '12 at 08:16
  • check out this page for the answer http://stackoverflow.com/questions/104601/asp-net-response-redirect-to-new-window – Andy Stannard Jan 25 '12 at 08:44

1 Answers1

0

If you simply want to open some folder then you can try this way:

protected void Button1_Click(object sender, EventArgs e)     
{

System.Diagnostics.ProcessStartInfo processInfo = new System.Diagnostics.ProcessStartInfo();
        processInfo.FileName = "explorer.exe";
        processInfo.Arguments = Server.MapPath("YourFolderName");
        Response.Write(processInfo.Arguments.ToString());
        System.Diagnostics.Process.Start(processInfo);
}

Reply me if it works for you.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Tapas Mahata
  • 343
  • 6
  • 22
  • This answer seems to ignore that the question is about ASP.NET. This answer will attempt to open Explorer on the *server*, which is not what the OP wants. (Hint: You *can't* do what the OP wants) – Andrew Barber Jan 25 '12 at 09:37
  • **Also** Just FYI: Please read the site FAQ about including signatures in your post. I'll edit it back out for you again; please don't put it back. http://stackoverflow.com/faq#signatures – Andrew Barber Jan 25 '12 at 09:45