Hi Everyone,
Please see the code below.
I put a file (testing.txt) into the C:\My Projects\Uploaded Files folder. When I run the *.aspx file and click on the "View File" link. It shows "The page cannot be found".
When I right-click on the "View File" link. And then select
"Copy Shortcut". And then I paste. Then I get
http://localhost/C:/My%20Projects/Uploaded%20Files//testing.txt
How can I remove "http://localhost/" from
[<a href=\"/C:\\My Projects\\Uploaded Files\\/" + strFileName + "\">View File</a>]
// ---- *.aspx file is shown below ----
<p><asp:label runat="server" id="lblResults" /></p
// --- *.cs file is shown below -------
String strFileName = "testing.txt";
lblResults.Text = "<hr><p>Your file, [<a href=\"/C:\\My Projects\\Uploaded Files\\/" + strFileName + "\">View File</a>]"</p>;MayLam forgive me if I am wrong on this one but I assume that you are running this using Visual Studio or Visual Web Developer and eithier going through the debugger or the right click show in browser way.....when you do that thehttp://localhost is automaticly put there because your running it off of your own computer.....actually it might look more likehttp://localhost:port2676 now you may have just made a spelling mistake on here but your code should look more like so
Try that out and see how it workslblResults.Text ="<hr><p><a href='C:\My Projects\Uploaded Files\'" + strFileName +">" +"View File" +"</a></p>";
0 comments:
Post a Comment