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["R EMOTE_ADDR "]);
First one just return localhost.
Second one returns ip.
I actually need to return localhost:xxxxx
How can do that?
http://localhost:46232/Legend/testbyrick.aspx
Response.Write("http://" + Request.Url.Host);
Response.Write("<br>http://" + Request.ServerVariables["R
First one just return localhost.
Second one returns ip.
I actually need to return localhost:xxxxx
How can do that?
Uri url = Request.Url;
Response.Write(uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port);
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="t rue"
OnRebind="RebindGrid"
GroupBy="LoweredUserName"
FolderStyle="http://localhost:46232/xxx/Oboutstyles/Grid/premiere_blue"
how can i replace the localhost:46232?
like this.
<obout:Grid id="grid1" runat="server" CallbackMode="true" Serialize="true" AutoGenerateColumns="false
AllowGrouping="true" ShowMultiPageGroupsInfo="t
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.
e.g.
Uri url = Request.Url;
grid1.FolderStyle = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port + "/xxx/Oboutstyles/Grid/premiere_blue";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
can't you do this instead?
Uri url = Request.Url;
grid1.FolderStyle = ResolveClientUrl("~/xxx/Oboutstyles/Grid/premiere_blue");
ignore the Uri declaration in the previous comment.
i.e. just
i.e. just
grid1.FolderStyle = ResolveClientUrl("~/xxx/Oboutstyles/Grid/premiere_blue");
ASKER
I need to do on frontend...
<obout:Grid id="grid1" runat="server" CallbackMode="true" Serialize="true" AutoGenerateColumns="false "
AllowGrouping="true" ShowMultiPageGroupsInfo="t rue"
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="MeetingCityStat e" 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" />
<obout:Grid id="grid1" runat="server" CallbackMode="true" Serialize="true" AutoGenerateColumns="false
AllowGrouping="true" ShowMultiPageGroupsInfo="t
OnRebind="RebindGrid"
GroupBy="LoweredUserName"
FolderStyle="http://localhost:46232/Legend/Oboutstyles/Grid/style_5"
>
<Columns>
<obout:Column ID="Column1" DataField="LoweredUserName
<obout:Column ID="Column2" DataField="CustName" HeaderText="Customer Name" runat="server" />
<obout:Column ID="Column3" DataField="MeetingCityStat
<obout:Column ID="Column4" DataField="MeetingType" HeaderText="Type" runat="server" />
<obout:Column ID="Column5" DataField="DescLeadSource"
<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.
e.g.
FolderStyle="~/Legend/Oboutstyles/Grid/style_5"
or
FolderStyle="Legend/Oboutstyles/Grid/style_5"
Request.Url.AbsoluteUri
for the full path
and
Request.Url.Authority
for the localhost:portinfo