Re: URL Rewriting ?

From: Marco Scheel (atwork_at_visual-evolution.de)
Date: 10/04/04


Date: Mon, 4 Oct 2004 10:05:10 +0200

Befor man da was eigenes erfindet:

<<http://www.15seconds.com/issue/030522.htm>>

<<http://www.codeproject.com/aspnet/URLRewriter.asp>>

Ciao Marco

"Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> schrieb im
Newsbeitrag news:upyvcy5pEHA.1712@tk2msftngp13.phx.gbl...
> Du solltest vieleicht mal überlegen, ob du nicht von AUSSEN
> (Config/Datenbank/...) sagst was wohin redirected wird. Dann kannst du die
> Klasse immer wieder benutzen...
>
> --
> Daniel Fisher(lennybacon)
> MCP C# ASP.NET
> Blog: http://www.lennybacon.com/
>
>
>
> "Andy Hawk" <anonymous@discussions.microsoft.com> wrote in message
> news:14ca01c4a799$f5fb79b0$a301280a@phx.gbl...
> THX
>
> werd ich heute abend gleich mal versuchen :)
>
> gruss Andy
>
>
> >-----Originalnachricht-----
> >Hi Andy
> >
> >Du solltest auf jeden Fall RegEx und Request.RawUrl
> benutzen.
> >
> >protected void Application_BeginRequest(Object sender,
> EventArgs e)
> >{
> > HttpContext _incoming = HttpContext.Current;
> > string _oldpath = _incoming.Request.RawUrl.ToLower();
> > Regex _regex = new Regex(@"page+(\d)+\.aspx+\?*(\.)*",
> > RegexOptions.IgnoreCase |
> RegexOptions.IgnorePatternWhitespace);
> > string _newstring = "WebForm1.aspx?id=$1&$2";
> > MatchCollection _matches = _regex.Matches(_oldpath);
> > if (_matches.Count > 0)
> > {
> > _newstring = _regex.Replace(_oldpath, _newstring);
> > _incoming.RewritePath(_newstring);
> > }
> >}
> >
> >
> >--
> >Daniel Fisher(lennybacon)
> > MCP C# ASP.NET
> >Blog: http://www.lennybacon.com/
> >
> >
> >
> >"Andy Hawk" <anonymous@discussions.microsoft.com> wrote
> in message
> >news:456201c4a6f4$13525390$a501280a@phx.gbl...
> >Hallo zusammen
> >
> >hab da ein kleines Problem. Ich habe auf einer MS Seite
> >einen Bericht gelesen, wo es um das Thema URL Rewriting.
> >Ich finde das eine sehr gute sache nur habe ich damit ein
> >kleines Problem.
> >
> >Ich habe es mit folgendem Code versucht Testweise.
> >
> >protected void Application_BeginRequest(Object sender,
> >EventArgs e)
> >{
> >string page = Request.Url.Segments
> >[Request.Url.Segments.Length - 1];
> >
> >if(page.ToLower().StartsWith("seite"))
> >{
> >string id = page.Substring(5, page.Length -
> > 10);
> >Context.RewritePath(string.Format
> >("seite.aspx?id={0}", id));
> >}
> >}
> >
> >funktioniert alles perfekt.
> >
> >Aber jetzt kommts. Wie kann ich doch noch einen Parameter
> >dazu hängen?
> >
> >Das Problem liegt dabei. Ich habe meine seiten die per ID
> >aufgerufen werden, teilweise benötige ich jedoch 2
> >Parameter und wenn ich jetzt z.b.
> >
> >seite12.aspx?prod=5
> >
> >mache, dann wird das prod=5 übersehen!?!
> >
> >Kann man das irgendwie lösen?
> >
> >THX und Gruss
> >Andy
> >
> >
> >.
> >
>
>



Relevant Pages

  • Re: file.move to unc causes error
    ... Daniel Fisher ... MCP ASP.NET C# ... Blog: http://www.lennybacon.com/ ... "Michael McLaughlin" wrote in ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: redirect not working
    ... Have you tried to run the code on a different local machine or a VM? ... Daniel Fisher ... > server the redirect stops working. ... >> MCP C# ASP.NET ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Cast from type DBNull to type String is not valid.
    ... is not so nice cause you set the num of th column and not the name, ... Daniel Fisher ... MCP ASP.NET C# Blog: http://www.lennybacon.com/ "tshad" wrote in message ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Where to start? :)
    ... showing correspondance between MCP & Unix commands. ... Looks usefull, big thx! ... A Linux box connecting to MCP thru telnet. ... of our monitoring systems in one simple web version (Unix, Windows, ...
    (comp.sys.unisys)
  • Re: code-ausführung in einem template
    ... Daniel Fisher ... "Capior" wrote in message ... >> MCP ASP.NET C# ... >> Blog: http://www.lennybacon.com/ ...
    (microsoft.public.de.german.entwickler.dotnet.asp)