Space presenting as %20 in link

T

trichert

Ok , developing a .aspx page with Visual Web Studio (the full page is
at the bottom). Basically its a page that displays all my computers
and the current logged on user pulling data from a live Altiris
database.

This works fine, i have added a feature with a link for me to click to
run radmin against that computer so i can remote control it.

The link shows properly when I hover over it
"S:\apps\!drivers\WindowsETC\rview.bat PCNAME". However if i click the
link it does not work, if i copy the link and paste it into notepad it
shows up as

s:\apps\!drivers\WindowsETC\rview.bat%20PCNAME

Somehow i need to get a true space into this link and not have the aspx
process it. The line in question is line # 17, HyperLink1.NavigateUrl
= "S:\apps\!drivers\WindowsETC\rview.bat " & PCName

What am i doing wrong ?

Here is the entire file :

<%@ Page Language="VB" debug="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script runat="server">

Sub RowCommand(ByVal sender As Object, ByVal e As
GridViewCommandEventArgs)
Message.Text = e.CommandName & ", " &
e.CommandSource.ToString & ", " & e.CommandArgument
Dim Grid As GridView
Dim PCName As String
Grid = sender
PCName = Grid.Rows.Item(e.CommandArgument).Cells(1).Text
Message.Text = PCName
' HyperLink1.NavigateUrl = "C:\Program
Files\RAdmin\Radmin.exe /connect:" & PCName
HyperLink1.NavigateUrl =
"S:\apps\!drivers\WindowsETC\rview.bat" & PCName
'Chr(34) = "
'Chr(32) = space


End Sub


</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="Message" runat="server"
Width="419px"></asp:TextBox><br />
<asp:HyperLink ID="HyperLink1" runat="server"
Width="423px">HyperLink</asp:HyperLink><br />
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" OnRowCommand="RowCommand">
<Columns>
<asp:ButtonField
DataTextField="PCName"
HeaderText="Link to RAdmin"
CommandName=DataTextField
InsertVisible="False" />
<asp:BoundField DataField="PCName"
HeaderText="PCName" SortExpression="PCName" />
<asp:BoundField DataField="LoggedOnUser"
HeaderText="LoggedOnUser" ReadOnly="True"
SortExpression="LoggedOnUser" />
<asp:BoundField DataField="Serial" HeaderText="Serial"
SortExpression="Serial" />
<asp:BoundField DataField="Model" HeaderText="Model"
SortExpression="Model" />
<asp:BoundField DataField="FreeDiskSpace"
HeaderText="FreeDiskSpace" SortExpression="FreeDiskSpace" />
<asp:BoundField DataField="ram_total"
HeaderText="ram_total" SortExpression="ram_total" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:eXpressConnectionString %>"
SelectCommand="SELECT [PCName], [LoggedOnUser], [Serial],
[Model], [FreeDiskSpace], [ram_total] FROM [vw_Randy_PC_List] Order By
[LoggedOnUser]">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
 
T

trichert

I appreciate the responce, i tried that and the aspx page actually
shows the &nbsp instead of putting a space in there.


Will Asrari wote:
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

An url can not contain spaces, they have to be encoded. The %20 code is
the encoded form of a space, so that is perfectly correct.

So the problem is not the space in the url.

What do you mean when you say that the link "does not work"? What
happens? Do you get an error message?

Where is the file located? Do you have access to the s: drive from the
client computer?

Ok , developing a .aspx page with Visual Web Studio (the full page is
at the bottom). Basically its a page that displays all my computers
and the current logged on user pulling data from a live Altiris
database.

This works fine, i have added a feature with a link for me to click to
run radmin against that computer so i can remote control it.

The link shows properly when I hover over it
"S:\apps\!drivers\WindowsETC\rview.bat PCNAME". However if i click the
link it does not work, if i copy the link and paste it into notepad it
shows up as

s:\apps\!drivers\WindowsETC\rview.bat%20PCNAME

Somehow i need to get a true space into this link and not have the aspx
process it. The line in question is line # 17, HyperLink1.NavigateUrl
= "S:\apps\!drivers\WindowsETC\rview.bat " & PCName

What am i doing wrong ?

Here is the entire file :

<%@ Page Language="VB" debug="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script runat="server">

Sub RowCommand(ByVal sender As Object, ByVal e As
GridViewCommandEventArgs)
Message.Text = e.CommandName & ", " &
e.CommandSource.ToString & ", " & e.CommandArgument
Dim Grid As GridView
Dim PCName As String
Grid = sender
PCName = Grid.Rows.Item(e.CommandArgument).Cells(1).Text
Message.Text = PCName
' HyperLink1.NavigateUrl = "C:\Program
Files\RAdmin\Radmin.exe /connect:" & PCName
HyperLink1.NavigateUrl =
"S:\apps\!drivers\WindowsETC\rview.bat" & PCName
'Chr(34) = "
'Chr(32) = space


End Sub


</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="Message" runat="server"
Width="419px"></asp:TextBox><br />
<asp:HyperLink ID="HyperLink1" runat="server"
Width="423px">HyperLink</asp:HyperLink><br />
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" OnRowCommand="RowCommand">
<Columns>
<asp:ButtonField
DataTextField="PCName"
HeaderText="Link to RAdmin"
CommandName=DataTextField
InsertVisible="False" />
<asp:BoundField DataField="PCName"
HeaderText="PCName" SortExpression="PCName" />
<asp:BoundField DataField="LoggedOnUser"
HeaderText="LoggedOnUser" ReadOnly="True"
SortExpression="LoggedOnUser" />
<asp:BoundField DataField="Serial" HeaderText="Serial"
SortExpression="Serial" />
<asp:BoundField DataField="Model" HeaderText="Model"
SortExpression="Model" />
<asp:BoundField DataField="FreeDiskSpace"
HeaderText="FreeDiskSpace" SortExpression="FreeDiskSpace" />
<asp:BoundField DataField="ram_total"
HeaderText="ram_total" SortExpression="ram_total" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:eXpressConnectionString %>"
SelectCommand="SELECT [PCName], [LoggedOnUser], [Serial],
[Model], [FreeDiskSpace], [ram_total] FROM [vw_Randy_PC_List] Order By
[LoggedOnUser]">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
 
T

trichert

Goran,

Thank you for your responce :

#1) When i click the link nothing at all happens, no error nothing if i
hover over the link it "looks" right.
#2) If i remove the space and the & PCName, and then click the link it
DOES run the rview.bat just fine.
#3) Yes both the client and server have access to the S drive.

Is there a better way to get a dynamic web site to call an executable
file and pass it a variable ?
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top