Solved

asp.net c#

Posted on 2011-03-09
9
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 36

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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
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
 
LVL 36

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Learn about cloud computing and its benefits for small business owners.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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