bonjour,

l'url de ma page aspx est:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
www.website.com/swap.aspx?ID=1
je veux utiliser rewriting url pour l'obtenir comme:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
www.website.com/hotel-paris-france.aspx
les mots hotel, paris, france sont dynamic du database.

j'ai ce code, est correct ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
void Application_BeginRequest(object sender, EventArgs e)
    {
        // Get the current path
        string CurrentURL_Path = Request.Path.ToLower();
 
        if (CurrentURL_Path.StartsWith("/swap/"))
        {
            CurrentURL_Path = CurrentURL_Path.Trim('/');
            string NewsID = CurrentPath.Substring(CurrentPath.IndexOf('/'));
            HttpContext MyContext = HttpContext.Current;
            MyContext.RewritePath("/hotel-paris-france.aspx");
        }
    }