Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Request.ApplicationPath and root websites with ASP.NET???
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brock  
View profile  
 More options Mar 11 2002, 3:33 pm
Newsgroups: microsoft.public.dotnet.framework.aspnet, microsoft.public.inetserver.iis
From: "Brock" <br...@vrsdata.com>
Date: Mon, 11 Mar 2002 12:32:17 -0800
Local: Mon, Mar 11 2002 3:32 pm
Subject: Request.ApplicationPath and root websites with ASP.NET???
I'll try to keep this brief.
Can anyone help me to understand why IIS cannot use the
Request.ApplicationPath the same way in a root website as it does in a
virtual directory?  My reference is to the latest I Buy Spy portal code, but
is applicable to any code of this type.  This also applies to the use of the
tilde "~" in ASP.NET code.  The tilde should represent the application path
in ASP.NET code so these should be interchangeable.
If you are in a virtual directory:
http://portal.ragingfrog.com/portal - Request.ApplicationPath = /portal
In the root site:
http://portal.ragingfrog.com - Request.ApplicationPath = /

This in itself causes problems, but can be handled.  You'd think IIS would
be able to handle it though.  If you look at the site links above and hover
over the tabs on the page you will see this difference in URL generation
using the Request.ApplicationPath.  It is the EXACT same code deployed to
both a virtual directory and the root.  One works, one does not.
This is the code:
*Extra spaces have been added to prevent HTML rendering in this message*

< a href='< %= Application("AppPath") % >/DesktopDefault.aspx?tabindex< %#
Container.ItemIndex % >=&tabid=< %# Ctype(Container.DataItem,
TabStripDetails).TabId% >' class="OtherTabs">< %# Ctype(Container.DataItem,
TabStripDetails).TabName % ></a>

I realize the ~ only works with the new ASP.NET controls and will not work
in this case.
Any input would be greatly appreciated.

Thanks,
Brock


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Timney \(Microsoft MVP\)  
View profile  
 More options Mar 11 2002, 5:35 pm
Newsgroups: microsoft.public.dotnet.framework.aspnet, microsoft.public.inetserver.iis
From: "John Timney \(Microsoft MVP\)" <xyztimn...@btinternet.com>
Date: Mon, 11 Mar 2002 22:26:16 -0800
Local: Tues, Mar 12 2002 1:26 am
Subject: Re: Request.ApplicationPath and root websites with ASP.NET???
I think its telling you the correct information.  Relative to root,
http://portal.ragingfrog.com/portal - represents an application path of
/portal
relative to root: http://portal.ragingfrog.com - represents an application
path of /

That said, I cant see exactly what your problem is.  You seem to need
something a little more flexible, like the root & the application path
together.  You might find the URL object more flexible for your needs.

Try using the Request.URL object, its very flexible in breaking down the
actual request location.  Try this:

Request.Url.GetLeftPart(UriPartial.Authority)

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional Windows Forms
     ISBN: 1861005547
Professional JSP
    ISBN: 1861003625
Beginning JSP Web Development
    ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Brock" <br...@vrsdata.com> wrote in message

news:uGlhOvTyBHA.2324@tkmsftngp02...

Ctype(Container.DataItem,


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brock  
View profile  
 More options Mar 11 2002, 6:55 pm
Newsgroups: microsoft.public.dotnet.framework.aspnet, microsoft.public.inetserver.iis
From: "Brock" <br...@vrsdata.com>
Date: Mon, 11 Mar 2002 15:53:54 -0800
Local: Mon, Mar 11 2002 6:53 pm
Subject: Re: Request.ApplicationPath and root websites with ASP.NET???
Yes, I'll have to look at that.  The thing is, that code came straight out
of the I Buy Spy portal site from Microsoft.  I'm trying to figure out if
their code doesn't work, or if it's me.  I'll give your suggestion a shot.

Thanks for the reply,
Brock

"John Timney (Microsoft MVP)" <xyztimn...@btinternet.com> wrote in message
news:ePhuJzUyBHA.2856@tkmsftngp05...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brock  
View profile  
 More options Mar 12 2002, 2:07 am
Newsgroups: microsoft.public.dotnet.framework.aspnet, microsoft.public.inetserver.iis
From: "Brock" <br...@vrsdata.com>
Date: Mon, 11 Mar 2002 23:05:35 -0800
Local: Tues, Mar 12 2002 2:05 am
Subject: Re: Request.ApplicationPath and root websites with ASP.NET???
John,

The problem is this. When deployed to a virtual directory, I need the
root/virtual dir. When deployed to the root, I need just the root. That is
where the tilde and the ApplicationPath are having problems. Neither one of
them works in BOTH scenarios.

Brock

"John Timney (Microsoft MVP)" <xyztimn...@btinternet.com> wrote in message
news:ePhuJzUyBHA.2856@tkmsftngp05...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brock  
View profile  
 More options Mar 12 2002, 3:33 am
Newsgroups: microsoft.public.dotnet.framework.aspnet, microsoft.public.inetserver.iis
From: "Brock" <br...@vrsdata.com>
Date: Tue, 12 Mar 2002 00:30:31 -0800
Local: Tues, Mar 12 2002 3:30 am
Subject: Re: Request.ApplicationPath and root websites with ASP.NET???
I have a solution.  I might be able to clean it up more with a little more
research, but this works for both virtual directories and root sites.  The
If statement checks on every request, but the code should only process once.
I put this code in the Application_BeginRequest:

'  Build the Application Path
If Application("AppPath") = Nothing Then
 Dim sAbsUri As String = Request.Url.AbsoluteUri
 Dim sRawUrl As String = Request.RawUrl

 If Request.ApplicationPath = "/" Then
  Application("AppPath") = Left(sAbsUri, Len(sAbsUri) - Len(sRawUrl))
 Else
  Application("AppPath") = Left(sAbsUri, Len(sAbsUri) - Len(sRawUrl)) &
Request.ApplicationPath
 End If
End If

Then just replace all the script calls for <%= Request.ApplicationPath%>
with <%= Application("AppPath")%>
If you have any other suggextions, let me know.

Brock

"Brock" <br...@vrsdata.com> wrote in message

news:uGlhOvTyBHA.2324@tkmsftngp02...

Ctype(Container.DataItem,


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google