Solved

asp.net c#

Posted on 2011-03-09
9
241 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:Webboy2008
  • 5
  • 2
  • 2
9 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 35090208
Use:
Request.Url.AbsoluteUri
for the full path
and
Request.Url.Authority
for the localhost:portinfo
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 35090347

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

Open in new window

0
 

Author Comment

by:Webboy2008
ID: 35090396
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?
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 35090411
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

0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 35090438
Try:
FolderStyle="<%=Request.Url.AbsoluteUri%>"
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 35090465
can't you do this instead?
Uri url = Request.Url;
grid1.FolderStyle = ResolveClientUrl("~/xxx/Oboutstyles/Grid/premiere_blue");

Open in new window

0
 
LVL 10

Expert Comment

by:hosneylk
ID: 35090470
ignore the Uri declaration in the previous comment.

i.e. just

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

Open in new window

0
 

Author Comment

by:Webboy2008
ID: 35094157
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" />
            
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 35094223
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

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now