Reputation: 20011
I have a simple folder structure for my multilingual website on localhost
Default.aspx
images
css
js
en/Default.aspx
en/ContactUs.aspx
....
ar/Default.aspx
ar/xxxxx.aspx
Problem i am facing is very strange to me. i have a simple code to check the browser language set by user and accordingly i redirect user to English or Arabic version of website.
Irrecpective of what code i wring it always redirects me to English version of website and executes the en/Default.aspx
page
Even commenting all the code in Default.aspx
page it still redirect it to the en/Default.aspx
page. while it should not do any thing.
I have set Default.aspx as Set As Default Page but it doesn't make any difference. I removed even global.asa
that had routing code, i also removed all the compiler code related to this website on local host but it still keeps doing the same thing.
I have checked web.config file there is nothing wrong with that.
Even after removing the Default.aspx
page it sill redirects me to en/Default.aspx
i am frustrated with this problem.
I am not sure what is wrong. I re-started system with no result.
I am using visual studio 2010 for asp.net web form project.
http://localhost:49831/AlShindagah/
ALWAYS take me to below URL
http://localhost:49831/AlShindagah/en/Default.aspx
CODE of Default.aspx before i deleted it
public partial class DefaultMain : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//switch (Session["lang"].ToString().ToLower())
//{
// case "en-us":
// Response.RedirectPermanent("~/en/Default.aspx");
// break;
// case "ar-ae":
// Response.RedirectPermanent("~/ar/Default.aspx");
// break;
// default:
// Response.RedirectPermanent("~/en/Default.aspx");
// break;
//}
}
//// Localization and Globalization code
//protected override void InitializeCulture()
//{
// String lang = Request["Language"];
// Session["lang"] = Helper.DetectLanguage(lang);
// //Set Direction of page LTR/RTL
// if (Session["lang"] == "ar-AE")
// {
// Session["PageDIR"] = "rtl";
// }
// else
// {
// Session["PageDIR"] = "ltr";
// }
// base.InitializeCulture();
//}
}
Upvotes: 0
Views: 707
Reputation: 1333
You had previously used Response.RedirectPermanent("~/en/Default.aspx");
. A complying browser would remember this and always redirect you there.
Clear your browser cache and try again :)
As a side note, use Redirect
instead of RedirectPermanent
. If I'm accessing www.mysite.com from a browser and www.mysite.com RedirectPermanent
's me to www.myothersite.com, a complying browser would remember this and for all future requests to www.mysite.com, it would call www.myothersite.com.
Upvotes: 1