path in querystring

  • Thread starter Thread starter Miro
  • Start date Start date
M

Miro

Hi!

How can I get a path from a Html (or aspx, it doesn't
matter) to an aspx-site.

I'm sending a path (C:\dir...\file) from the html-page
within a querystring:
page.aspx?path=C:\dir...\file

in the page_load i recieve the path:
String path = Request.QueryString["path"];

....but I can't use it in for example:
File.Exist(path);

The debuggger shows an "@" in front of the path-string:
@"C:\dir...\file"


/Miro
 
Miro said:
Hi!

How can I get a path from a Html (or aspx, it doesn't
matter) to an aspx-site.

I'm sending a path (C:\dir...\file) from the html-page
within a querystring:
page.aspx?path=C:\dir...\file

in the page_load i recieve the path:
String path = Request.QueryString["path"];

...but I can't use it in for example:
File.Exist(path);

The debuggger shows an "@" in front of the path-string:
@"C:\dir...\file"


/Miro

Did you try it? The "@" is added to the output by the debugger, because the
string
contains a backslash. The "real" string doesn't contain that "@".
Try displaying the string in a textbox (or whatever, as long as it is not
the debugger)
then you will see the correct text.

Hans Kesting
 
Hello Hans!

The File.Exist method returns false though the path is
correct. But I guess it has something to do with spaces
in path because the path contained the folder \Documents
and settings\. When I tried a simple path C:\file it
returned true. Anyway, I found a different solution for
this case, not involving querystrings. Thanks anyway!

/Miro
-----Original Message-----

Hi!

How can I get a path from a Html (or aspx, it doesn't
matter) to an aspx-site.

I'm sending a path (C:\dir...\file) from the html-page
within a querystring:
page.aspx?path=C:\dir...\file

in the page_load i recieve the path:
String path = Request.QueryString["path"];

...but I can't use it in for example:
File.Exist(path);

The debuggger shows an "@" in front of the path-string:
@"C:\dir...\file"


/Miro

Did you try it? The "@" is added to the output by the debugger, because the
string
contains a backslash. The "real" string doesn't contain that "@".
Try displaying the string in a textbox (or whatever, as long as it is not
the debugger)
then you will see the correct text.

Hans Kesting


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top