MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Url Rewritting issue - custom profiles.  (Mono Support )

Viewed 10383 time(s), 4 post(s) 9/7/2011 5:15:21 PMby shawndg
shawndg

shawndg

9/7/2011 5:15:21 PM
Hello,

I am trying to make my urls point to profile locations www.sitename/membername..

so far I am able to point it to to /music but even then I need a / slash for it to work..

http://localhost/music/testband - dont work.
http://localhost/music/testband/ - works

what I want to work if possible but if not I will settle with http://localhost/music/testband
http://localhost/theband

But.. I want to remove the / from the end..

Below is my web config rewrite rules..

<register logger="MonoSoftware.UrlRewriter.Logging.DebugLogger, MonoSoftware.UrlRewriter" />
     <if url="^(.*)/language/(.*)/(.*).aspx(\?(.+))?$" rewrite="$1/$3.aspx?language=$2&$5" />
     <if url="^(.*)/language/(.*)/(.*).aspx$" rewrite="$1/$3.aspx?language=$2" />
     <if url="^(.*)/language/(.*)/(.*).ashx(\?(.+))?$" rewrite="$1/$3.ashx?language=$2&$5" />
     <if url="^(.*)/language/(.*)/(.*).ashx$" rewrite="$1/$3.ashx?language=$2" />
     <if url="^(.*)/language/(.*)/(\?(.+))?$" rewrite="$1/?language=$2&$4" />
      
     <!--basic navigation TheScene-->
     <rewrite url="^(.*)/scenenews(.*)" to="$1/News.aspx" rewrite="$1/News.aspx" /> name="NewsPage/" />
     <rewrite url="^(.*)/concerts(.*)" to="$1/concerts.aspx" rewrite="$1/concerts.aspx" /> name="ConcertsPage/" />
     <rewrite url="^(.*)/contact(.*)" to="$1/Contact.aspx" rewrite="$1/Contact.aspx" /> name="ContactPage/" />
     <rewrite url="^(.*)/onlinestore(.*)" to="$1/OnlineStore.aspx" rewrite="$1/OnlineStore.aspx" /> name="OnlineStorePage/" />
     <rewrite url="^(.*)/Artists(.*)" to="$1/Artists.aspx" rewrite="$1/Artists.aspx" /> name="ArtistPage/" />
     <rewrite url="^(.*)/MusiciansClassifieds(.*)" to="$1/MusiciansClassifieds.aspx" rewrite="$1/MusiciansClassifieds.aspx" /> name="MusiciansClassifiedsPage/" />
 
     <!--advanced classified navigation TheScene-->
     <set property="ClassifiedsFolder" value="/Classifieds/" />
     <rewrite url="^(.*)/Classifieds(.*)/(.*)/(.*)" to="${ClassifiedsFolder}$3/$4.aspx" /> name="ClassifiedsAddPage/" />
 
     <!-- dynamic blog post rules, can be used regardless of the actual name of the page that holds blog parts -->
     <rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&$7" name="BlogPost" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/posts/(.*)/Page/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPageNo=$4&$6" name="BlogPostsPaged" defaultPage="/Blog.aspx" urlPattern="/{PageName}/posts/{Slug}/Page/{PageNo}/" />
     <rewrite url="^(.*)/(.*)/posts/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&$5" name="BlogPosts" defaultPage="/Blog.aspx" urlPattern="/{PageName}/posts/{Slug}/" />
     <rewrite url="^(.*)/(.*)/search/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&SearchAction=$4&SearchValue=$5&$7" name="BlogSearch" defaultPage="/Blog.aspx" urlPattern="/{PageName}/search/{Slug}/{SearchAction}/{SearchValue}/" />
     <rewrite url="^(.*)/(.*)/blog-tag/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&SearchAction=tag&SearchValue=$4&$6" name="BlogTag" defaultPage="/Blog.aspx" urlPattern="/{PageName}/blog-tag/{Slug}/{Tag}/" />
     <rewrite url="^(.*)/(.*)/settings/(.*)/(\?(.+))?$" to="$1/$2.aspx?ShowBlogSettings=true&BlogSlug=$3&$5" name="BlogSettings" defaultPage="/Blog.aspx" urlPattern="/{PageName}/settings/{Slug}/" />
     <rewrite url="^(.*)/(.*)/comments/(.*)/(\?(.+))?$" to="$1/$2.aspx?ShowBlogCommentsAdmin=true&BlogSlug=$3&$5" name="BlogCommentsAdmin" defaultPage="/Blog.aspx" urlPattern="/{PageName}/comments/{Slug}/" />
     <rewrite url="^(.*)/(.*)/edit/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&BlogEditMode=true&$7" name="BlogPostEdit" defaultPage="/Blog.aspx" urlPattern="/{PageName}/edit/{Blog.Slug}/{IdentityId}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/insert/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogInsertMode=true&$5" name="BlogPostInsert" defaultPage="/Blog.aspx" urlPattern="/{PageName}/insert/{Slug}/" />
     <!-- shows all blog posts regardless of the blog they were posted to -->
     <rewrite url="^(.*)/(.*)/posts/(\?(.+))?$" to="$1/$2.aspx$3" name="AllBlogPosts" defaultPage="/Blog.aspx" urlPattern="/{PageName}/posts/{Slug}/" />
     <rewrite url="^(.*)/(.*)/posts/(.*)/wlwmanifest.xml(\?(.+))?$" to="$1/wlwmanifest.xml" name="WlwManifest" urlPattern="/wlwmanifest.xml" /><set property="SocialNetworkingFolder" value="/MonoX/Pages/SocialNetworking/" />
      
     <!-- profile -->
     <rewrite url="^(.*)/profile/(.*)/(\?(.+))?$" to="$1${SocialNetworkingFolder}UserProfile.aspx?UserName=$2&$4" name="Profile" urlPattern="/profile/{UserNameUrlEncoded}/" />
      
     <!-- file view -->
     <rewrite url="^(.*)/fileview/(.*)/(.*)/(\?(.+))?$" to="$1${SocialNetworkingFolder}FileView.aspx?FileId=$2&ReturnPageId=$3&$5" name="FileView" urlPattern="/fileview/{FileId}/{ReturnPageId}/" />
     <rewrite url="^(.*)/fileviewsa/(.*)/(.*)/(\?(.+))?$" to="$1${SocialNetworkingFolder}FileViewStandalone.aspx?FileId=$2&ReturnPageId=$3&$5" name="FileViewStandalone" urlPattern="/fileviewsa/{FileId}/{ReturnPageId}/" />
     <rewrite url="^(.*)/(.*)/filelist-tag/(.*)/(\?(.+))?$" to="$1/$2.aspx?fTag=$3&$5" name="FileListTagFilter" urlPattern="/{PageName}/filelist-tag/{Slug}/" />
      
     <!-- site search -->
     <rewrite url="^(.*)/search/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/MonoX/SearchResults.aspx?srchq=$2&$4" name="SiteSearch" urlPattern="/search/{Query}/" />
      
     <!-- dynamic group rules, can be used regardeless of the actual name of the page that holds group parts -->
     <rewrite url="^(.*)/(.*)/GroupView/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?GroupId=$3&$6" name="GroupView" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupView/{ShortId}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/GroupEdit/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?GroupId=$3&EditMode=true&$6" name="GroupEdit" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupEdit/{ShortId}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/GroupList/(\?(.+))?$" to="$1/$2.aspx$3" name="GroupList" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupList/" />
     <rewrite url="^(.*)/(.*)/GroupInsert/(\?(.+))?$" to="$1/$2.aspx?InsertMode=true&$4" name="GroupInsert" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupInsert/" />
     <rewrite url="^(.*)/(.*)/GroupSearch/(.*)/(\?(.+))?$" to="$1/$2.aspx?SearchValue=$3&$5" name="GroupSearch" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupSearch/{SearchValue}/" />
     <rewrite url="^(.*)/(.*)/GroupSearch/(\?(.+))?$" to="$1/$2.aspx?ShowAllGroups=true&$4" name="GroupSearchShowAll" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupSearch/" />
     <rewrite url="^(.*)/(.*)/GroupCategory/(.*)/(\?(.+))?$" to="$1/$2.aspx?Category=$3&$5" name="GroupCategory" defaultPage="/MonoX/Pages/SocialNetworking/Groups.aspx" urlPattern="/{PageName}/GroupCategory/{CategorySlug}/" />
      
     <!-- social networking general -->
     <rewrite url="^(.*)/RequestConfirmation/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/MonoX/Confirmation.aspx?RequestType=$2&RequestId=$3&$5" name="RequestConfirmation" urlPattern="/RequestConfirmation/{RequestType}/{RequestId}/" />
      
     <!-- Photo Gallery -->
     <rewrite url="^(.*)/(.*)/activeview/(.*)/albumview/(.*)/(\?(.+))?$" to="$1/$2.aspx?AlbumId=$4&activeview=$3&$6" name="PhotoList" defaultPage="/MonoX/Pages/SocialNetworking/PhotoGallery.aspx" urlPattern="/{PageName}/{ActiveControlAction}/{ActiveControlValue}/{AlbumView}/{AlbumId}/" />
     <rewrite url="^(.*)/(.*)/activeview/(.*)/photoview/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?FileId=$4&AlbumId=$5&activeview=$3&$7" name="PhotoView" defaultPage="/MonoX/Pages/SocialNetworking/PhotoGallery.aspx" urlPattern="/{PageName}/{ActiveControlAction}/{ActiveControlValue}/{PhotoView}/{PhotoId}/{AlbumId}/" />
      
     <!-- discussion board -->
     <rewrite url="^(.*)/(.*)/dboard/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?boardId=$3&$6" name="Discussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/{PageName}/dboard/{BoardId}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/dtopic/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?topicId=$3&$6" name="DiscussionTopic" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/{PageName}/dtopic/{TopicId}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/dfilter/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?tftype=$3&$6" name="DiscussionTopicFilter" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/{PageName}/dfilter/{FilterType}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/dfilter-tag/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?tftype=$3&dbtTag=$4&$6" name="DiscussionTopicTagFilter" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/{PageName}/dfilter-tag/{FilterType}/{Slug}/" />
     <rewrite url="^(.*)/(.*)/dmessage/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?dmsgId=$3&dmsgMode=$4&$6" name="DiscussionEditMessage" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/{PageName}/dmessage/{MessageId}/{Mode}/" />
     
     <!-- dynamic content page -->
     <rewrite url="^(.*)/ContentPage/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/Content.aspx?hdci=$2&$4" name="ContentPage" urlPattern="/ContentPage/{ContentId}/" />
      
     <!-- my custom profile TheScene -->
     <set property="MusicProfile" value="/CustomProfiles/MusicProfile/" />
     <rewrite url="^(.*)/music/(.*)/(\?(.+))?$" to="$1${MusicProfile}/Music.aspx?UserName=$2&$4" name="music" urlPattern="/music/{UserNameUrlEncoded}" />
      
 
     <!-- do not remove the last rule - supports for default page if all rules above have failed -->
     <if url="^(.*)/\?language=(.*)(\?(.+))?$" rewrite="$1/Default.aspx?language=$2&$4" /></UrlRewriter>
This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

9/7/2011 5:49:53 PM
Your current custom profile rule works only for the URL with the ending slash. The easiest solution, without too much fiddling with the regular expressions, would involve adding a new rule below it:
<rewrite url="^(.*)/music/(.*)?$" to="$1${MusicProfile}/Music.aspx?UserName=$2" name="music" urlPattern="/music/{UserNameUrlEncoded}" />

Now these rules will catch URLs with and without the trailing slash.

This content has not been rated yet. 
7207 Reputation 956 Total posts
shawndg

shawndg

9/7/2011 6:09:35 PM
Thx, denis that did work..

Now I have been pondering some ideas because I want artist to be able to hand out their links with ease..

One of my ideas would be to emulate domains so they can say..
http://theband.mysite.com and then use a webconfig to rewrite that to a url that MonoX likes.


Update..

Figured out how to do it in IIs7 without MonoX
http://forums.iis.net/t/1155754.aspx

Not sure how to do it with MonoX

This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

9/7/2011 8:15:06 PM
That's one way to achieve what you want. However, we often use an alternative approach - a HttpModule that reads the request URL in the BeginRequest method, parses it and redirects/transfers the request to the right URL.
In any case, you will have to check out if your DNS supports the wildcard syntax. IIS 7 can handle it, but you need to set up your DNS before that.
This content has not been rated yet. 
7207 Reputation 956 Total posts