Space presenting as %20 in link

Discussion in 'ASP .Net' started by trichert@gmail.com, Jun 1, 2006.

  1. Guest

    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>
     
    , Jun 1, 2006
    #1
    1. Advertising

  2. Will Asrari Guest

    Maybe try:

    "http://www.link.com&nbsp;" & PCName
     
    Will Asrari, Jun 1, 2006
    #2
    1. Advertising

  3. Guest

    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:
    > Maybe try:
    >
    > "http://www.link.com&nbsp;" & PCName
     
    , Jun 1, 2006
    #3
  4. 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?

    wrote:
    > 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>
    >
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jun 1, 2006
    #4
  5. Guest

    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 ?
     
    , Jun 2, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rhino
    Replies:
    2
    Views:
    432
    Rhino
    Feb 11, 2005
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,955
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,767
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    1,081
    Steve Lamb
    Oct 23, 2003
  5. Ian Bicking
    Replies:
    2
    Views:
    765
    Michael Hudson
    Oct 24, 2003
Loading...

Share This Page