Link to home
Start Free TrialLog in
Avatar of Webboy2008
Webboy2008

asked on

asp.net c#

I tried to read the domain by using

http://localhost:46232/Legend/testbyrick.aspx

        Response.Write("http://" + Request.Url.Host);
        Response.Write("<br>http://" + Request.ServerVariables["REMOTE_ADDR"]);
First one just return localhost.
Second one returns ip.

I actually need to return localhost:xxxxx

How can do that?
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Use:
Request.Url.AbsoluteUri
for the full path
and
Request.Url.Authority
for the localhost:portinfo

Uri url = Request.Url;
Response.Write(uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port);

Open in new window

Avatar of Webboy2008
Webboy2008

ASKER

I need to do this one the frontend apsx
like this.

 <obout:Grid id="grid1" runat="server" CallbackMode="true" Serialize="true" AutoGenerateColumns="false"
                AllowGrouping="true" ShowMultiPageGroupsInfo="true"
                  OnRebind="RebindGrid"
                  GroupBy="LoweredUserName"
                   FolderStyle="http://localhost:46232/xxx/Oboutstyles/Grid/premiere_blue"


how can i replace the localhost:46232?
you could do this on page_load

e.g.
Uri url = Request.Url;
grid1.FolderStyle = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port + "/xxx/Oboutstyles/Grid/premiere_blue";

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can't you do this instead?
Uri url = Request.Url;
grid1.FolderStyle = ResolveClientUrl("~/xxx/Oboutstyles/Grid/premiere_blue");

Open in new window

ignore the Uri declaration in the previous comment.

i.e. just

grid1.FolderStyle = ResolveClientUrl("~/xxx/Oboutstyles/Grid/premiere_blue");

Open in new window

I need to do on frontend...
<obout:Grid id="grid1" runat="server" CallbackMode="true" Serialize="true" AutoGenerateColumns="false"
                AllowGrouping="true" ShowMultiPageGroupsInfo="true"
                  OnRebind="RebindGrid"
                  GroupBy="LoweredUserName"
                   FolderStyle="http://localhost:46232/Legend/Oboutstyles/Grid/style_5"

                  >
                  <Columns>
                  <obout:Column ID="Column1" DataField="LoweredUserName" Visible="false" HeaderText="Sale Name:" runat="server" />
                  <obout:Column ID="Column2" DataField="CustName"  HeaderText="Customer Name"  runat="server" />
                  <obout:Column ID="Column3" DataField="MeetingCityState"  HeaderText="City / State"  runat="server" />
                  <obout:Column ID="Column4" DataField="MeetingType"  HeaderText="Type"  runat="server" />
                  <obout:Column ID="Column5" DataField="DescLeadSource"  HeaderText="Lead Source" runat="server" />
                  <obout:Column ID="Column6" DataField="BeginDate" DataFormatString="{0:d}"   HeaderText="Meeting Date"  runat="server" />
                  <obout:Column ID="Column7" DataField="TimeIn"  HeaderText="Time In"  runat="server" />
            
what happens if you give a relative url?

e.g.
FolderStyle="~/Legend/Oboutstyles/Grid/style_5"

or 

FolderStyle="Legend/Oboutstyles/Grid/style_5"

Open in new window