View Single Post
Sponsorlu Bağlantılar
Zoque.Forum
Advertisement
Old 04.11.2005   #3 (permalink)
blurise
 
blurise's Avatar
 
Üyelik Tarihi: 05.12.2003
Yer: İstanbul
Mesaj: 898
Re: URL sayesinde veritabanından bilgi almak.

ASP.Net ile Global.asax icinde Application_BeginRequest eventinde Context.RewritePath methodunu cagirarak yukarida 2. sekilde gelen request leri 1. sekle cevirebilirsin.
Kod:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
	int pid = 404;
	string ru = Request.RawUrl.Trim();
	if(ru.EndsWith(".HTML")) pid = Convert.ToInt32(ru.Substring(ru.LastIndexOf("/") + 1).Replace(".HTML", ""));
	HttpContext.Current.RewritePath("Default.aspx?pageid=" + pid.ToString());
}
Burada onemli olan server tarafindan Adminlerin yapmasi gereken bir is var: .HTML yada arzuladigin diger dosya turunun de aspnet.dll e yonlendirmesi gerekiyor.
__________________
Günce;
Zübeyr Dereli;
PGP Public Key;
blurise şu an çevrimdışı   Mesajdan alıntı yaparak yeni bir cevap ekleyin