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.

Profile - URL - Rewritting problem.  (Mono Support )

Viewed 32050 time(s), 12 post(s) 2/28/2012 2:13:11 PMby shawndg
shawndg

shawndg

3/26/2012 4:23:54 PM
Ok I tried the code but still no luck.. has same problem.. once your in a subdomain the web browser sub domains every link unless they are absolute full urls.

Well other then try to deal with a mess of url rewrites I finally came up with a possible solution but MonoX is making this solution a little harder to implement then I thought because MonoX has some things set that I am worried about just changing...

the solution is fairy simple..
I want to detect it using the page load event and then use redirect from the primary page.

My MonoX configuration by default though is showing default aspx error messaages when the url rewrites fail.
I tried setting a error page to my own but then the pass through that is currently set prevents it from even working.

I dont want to just remove it because I am not sure how that would effect MonoX.

What I am trying to do is after all the url rewrites have failed.
I want do them apply my own code in a aspx file somewhere.. in this case maybe a custom error aspx page..

That will then go a step more, and detect if the page url is a music page and then response.redirct.. the logic of this is simple.
any thing with domain/bla is a music page.. so forward it to /music/bla and surpress the error page.

Something so simple as this if put in the correct location would then make the redirects work.
So I am thinking some simple logic at this point to redirect might work.

protected override void OnLoad(EventArgs e)
{

string[] url = Request.Url.AbsoluteUri.Split('/');

foreach (string part in url)
{
System.Diagnostics.Debug.Write(part + Environment.NewLine);
}


//Response.Redirect("www.google.com");
}

Any idea on how to implement this ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

3/27/2012 2:57:42 PM
I GOT SOMETHING TO WORK!!

I dont know if this is the best of ways.. but here is how i got it to work..

I created a Error.aspx page and then set up in iis7 a error page to output on 404 error Error.aspx

I then put behind the error.aspx page the code in the prev post, but the array changed because iis adds some other stuff to the page path..
So I changed it to 6 to detect. it.. and added some very simple logic..

string[] url = Request.Url.AbsoluteUri.Split('/');

//int i = 0;
//foreach (string part in url)
//{
// Response.Write(i + ": " + part + Environment.NewLine);
// i++;
//}

try
{

if (url[6].Contains(".") == false)
{
// ok its likly a band..
Response.Redirect(MyRootUrl + "music/" + url[6]);
}
}

catch
{
}

base.OnLoad(e); // the Load event is raised

// definitely comes after all listeners have been notified.

}
This content has not been rated yet. 
1871 Reputation 252 Total posts
1 2