Solved

asp.net c#

Posted on 2011-03-09
9
238 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

759 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

20 Experts available now in Live!

Get 1:1 Help Now