473,657 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Vanity URLs

Greetings,

I wrote code to handle vanity URLs, so--for example--the URL
http://localhost/myApp/bsmith.aspx is internally translated to
http://localhost/myApp/Support/UserP...px?user=bsmith.

The problem is that whenever I access the vanity URL,
http://localhost/myApp/bsmith.aspx, the page shows without any CSS
styles...quite ugly. However, when I get to the page directly using its
actual address, http://localhost/myApp/Support/UserP...px?user=bsmith, it
displays fine.

Does anyone know what I'm doing wrong? (The Global.asax.vb code is below)

Thank you!

Eric
'\\\
' NOTE: This code assumes "Imports System.IO"

Sub Application_Beg inRequest(ByVal sender As Object, _
ByVal e As EventArgs)
' Fires at the beginning of each request
Dim strPageOwner As String
Dim strCurrentPath As String
Dim strCustomPath As String

strCurrentPath = Request.Path.To Lower
With strCurrentPath

' Make sure the request is for the vanity URL, where it is an
' aspx page in the root directory, and it is not Default.aspx.

If .IndexOf("defau lt.aspx") = -1 AndAlso _
.IndexOf("/products/") = -1 AndAlso _
.IndexOf("/secure/") = -1 AndAlso _
.IndexOf("/support/") = -1 AndAlso _
.IndexOf("/about/") = -1 Then

strCustomPath = String.Format( _
"/myApp/Support/UserPage.aspx?u ser={0}", _
Path.GetFileNam eWithoutExtensi on(Request.Path ))

Context.Rewrite Path(strCustomP ath)

End If
End With

End Sub
'///


Nov 18 '05 #1
2 2048
Eric

I'm guessing that your css is not being referenced because the page cannot
find the relative path to the stylesheet.
Try making your stylesheet reference absolute such as <link
href="/styles.css" type="text/css" rel="stylesheet ">

Janaka

"Eric Lemmon" <er************ *@hotmail.com> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
Greetings,

I wrote code to handle vanity URLs, so--for example--the URL
http://localhost/myApp/bsmith.aspx is internally translated to
http://localhost/myApp/Support/UserP...px?user=bsmith.

The problem is that whenever I access the vanity URL,
http://localhost/myApp/bsmith.aspx, the page shows without any CSS
styles...quite ugly. However, when I get to the page directly using its
actual address, http://localhost/myApp/Support/UserP...px?user=bsmith, it displays fine.

Does anyone know what I'm doing wrong? (The Global.asax.vb code is below)

Thank you!

Eric
'\\\
' NOTE: This code assumes "Imports System.IO"

Sub Application_Beg inRequest(ByVal sender As Object, _
ByVal e As EventArgs)
' Fires at the beginning of each request
Dim strPageOwner As String
Dim strCurrentPath As String
Dim strCustomPath As String

strCurrentPath = Request.Path.To Lower
With strCurrentPath

' Make sure the request is for the vanity URL, where it is an
' aspx page in the root directory, and it is not Default.aspx.

If .IndexOf("defau lt.aspx") = -1 AndAlso _
.IndexOf("/products/") = -1 AndAlso _
.IndexOf("/secure/") = -1 AndAlso _
.IndexOf("/support/") = -1 AndAlso _
.IndexOf("/about/") = -1 Then

strCustomPath = String.Format( _
"/myApp/Support/UserPage.aspx?u ser={0}", _
Path.GetFileNam eWithoutExtensi on(Request.Path ))

Context.Rewrite Path(strCustomP ath)

End If
End With

End Sub
'///

Nov 18 '05 #2
Thanks for the quick reply, Janaka.

I looked over the the <link> tag a dozen times, both in the IDE and in the
rendered source code...but you're right!

It seems that using the vanity URL on the root directory is what threw me.
Because the URL was redirected to a subdirectory, the <link> tag no longer
applied. All I did to fix this was add an extra <link> tag in the
UserPage.aspx HTML source code that omitted the "../", directing the <link>
to the subdirectory instead of up one level

In other words, I changed my links from this:

<LINK href="../scripts/Styles.css" type="text/css" rel="stylesheet ">
<LINK href="../scripts/Menus.css" type="text/css" rel="stylesheet ">

to this:

<LINK href="../scripts/Styles.css" type="text/css" rel="stylesheet ">
<LINK href="../scripts/Menus.css" type="text/css" rel="stylesheet ">
<LINK href="scripts/Styles.css" type="text/css" rel="stylesheet ">
<LINK href="scripts/Menus.css" type="text/css" rel="stylesheet ">

A word of caution to anyone else trying this, *everything* is thrown off if
you redirect the context to a different subdirectory, including all your
links, image src, etc. It's much easier (and *much* less messy) to just
have the destination page in the same directory as your vanity URL.

Thanks again,

Eric
"Janaka" <ja****@magical ia.com> wrote in message
news:uA******** ******@TK2MSFTN GP12.phx.gbl...
Eric

I'm guessing that your css is not being referenced because the page cannot
find the relative path to the stylesheet.
Try making your stylesheet reference absolute such as <link
href="/styles.css" type="text/css" rel="stylesheet ">

Janaka

"Eric Lemmon" <er************ *@hotmail.com> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
Greetings,

I wrote code to handle vanity URLs, so--for example--the URL
http://localhost/myApp/bsmith.aspx is internally translated to
http://localhost/myApp/Support/UserP...px?user=bsmith.

The problem is that whenever I access the vanity URL,
http://localhost/myApp/bsmith.aspx, the page shows without any CSS
styles...quite ugly. However, when I get to the page directly using its
actual address, http://localhost/myApp/Support/UserP...px?user=bsmith,
it
displays fine.

Does anyone know what I'm doing wrong? (The Global.asax.vb code is

below)
Thank you!

Eric
'\\\
' NOTE: This code assumes "Imports System.IO"

Sub Application_Beg inRequest(ByVal sender As Object, _
ByVal e As EventArgs)
' Fires at the beginning of each request
Dim strPageOwner As String
Dim strCurrentPath As String
Dim strCustomPath As String

strCurrentPath = Request.Path.To Lower
With strCurrentPath

' Make sure the request is for the vanity URL, where it is an ' aspx page in the root directory, and it is not Default.aspx.
If .IndexOf("defau lt.aspx") = -1 AndAlso _
.IndexOf("/products/") = -1 AndAlso _
.IndexOf("/secure/") = -1 AndAlso _
.IndexOf("/support/") = -1 AndAlso _
.IndexOf("/about/") = -1 Then

strCustomPath = String.Format( _
"/myApp/Support/UserPage.aspx?u ser={0}", _
Path.GetFileNam eWithoutExtensi on(Request.Path ))

Context.Rewrite Path(strCustomP ath)

End If
End With

End Sub
'///


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3419
by: phpkid | last post by:
Howdy I've been given conflicting answers about search engines picking up urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3 Do search engines pick up these urls? I've been considering converting a site of mine to PHP-Nuke, but if the individual modules aren't picked up in search engines I'm not going to do it. Thanks phpKid
10
2036
by: Chris Guimbellot | last post by:
Hello, I am trying to create vanity URLs (I think that's what they are called) that link directly to an item's listing page on my site. Currently, the urls are set up something like the following: http://www.mydomain.com/productinfo.asp?prodID=00000 I am trying to configure them to be something like this:
26
12495
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
1
1813
by: DM | last post by:
I'm working on a site with more than 1700 HTML files. We'll be moving files around on this site a lot because we're reorganizing it. I'm thinking of writing a script that will convert all URLs in href and src attributes to absolute URLs with this form: href="/somedir/somefile.htm" src="/images/somecategory/image.gif" That way, if you move a page from one directory to another, the links and image references within the page will not...
2
2606
by: Showjumper | last post by:
How would i go about making vanity urls such that its really the same url for everyone but that it just appears different based on who logs in.
1
1369
by: Stimp | last post by:
I know how to create vanity urls for users when they append a .aspx to their name, but is it possible to pick up their name alone (without affixing .aspx?) e.g. in the global.asax file I can map the following url: www.mysite.com/someuser.aspx to www.mysite.com/users.aspx?userid=someuser
3
1815
by: Leon | last post by:
How to personalized different parts of my website using vanity sub-domain name url. example: my domain name is www.mydomain.com. I would like the vanity url to be myname.mydomain.com, and personalize the current page from the database using that vanity url ('myname.mydomain.com').
10
4908
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're called, an example of what I have in mind is index.php?page=). However, I can not figure out how to do this. I will eventually want to use SEF urls, but for now I'll be content just to have the dynamic urls. If anyone can tell me how to do this, I'd...
3
3865
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess which redirect you to normal URLs with GET parameters
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.