From: Hemant on 25 Sep 2009 05:26 Hi, Thanks for reply Here I am explain in detail what I want to do . void Application_BeginRequest(object sender, EventArgs e) { Here I pass book-asp.html to DataBase to get the ID where it match the same name book-asp.html If in my database there are two product in different category of same name as book-asp.html . or If i put the same product in two category than I got the wrong categoryid so I want to pass that category id from previous page so that i can fetch right product with right categoryid. } that's why I want to pass a ID . hope you can understand my problem. Thanks, Hemant "Alexey Smirnov" <alexey.smirnov(a)gmail.com> wrote in message news:e204ff3e-9b7f-4a18-b53c-d7e1f8820c85(a)y20g2000vbk.googlegroups.com... Hemant, I don't think you understand the problem. All what you need is to have something like this void Application_BeginRequest(object sender, EventArgs e) { string url = Context.Request.Url.AbsolutePath; if (url.Equals("/book-asp.html")) Context.RewritePath("/Product.aspx?ID=100", false); } where you don't need any query string because the requested url is book-asp.html and not Product.aspx?ID=100. Hope this helps On Sep 25, 9:37 am, "Hemant" <Hem...(a)nomail.com> wrote: > Hi, > Yes you are right. > > know at Application_BeginRequest I redirect . > I want to get that ID so that I can pass this to that page. > Thanks. > Hemant ."Alexey Smirnov" <alexey.smir...(a)gmail.com> wrote in message > > news:055762a5-34a2-470f-a9f0-f1fbc184dd81(a)l34g2000vba.googlegroups.com... > On Sep 25, 6:45 am, "Hemant" <Hem...(a)nomail.com> wrote: > > > > > > > Hi , > > Thanks for your replies. > > I am doing url rewriting . > > In Application_BeginRequest i want to get ID's of the string. > > At this function I call the Context.Rewrite Path to Redirect the correct > > page > > What I need that I want to store that ID some where so that I can pass > > that > > ID to the Right page. > > For Example : > > My URL iswww.Test.com/book-asp.html > > But the actual URL for this iswww.Test.com/Product.aspx?ID=100 > > I want to get this ID at that function so that I can call the correct > > page > > with correct ID. > > Thanks, > > Hemant > > Let's see what we have > > > My URL iswww.Test.com/book-asp.html > > ok > > > But the actual URL for this iswww.Test.com/Product.aspx?ID=100 > > ok > > Now, going back to your question - what do we have in > Application_BeginRequest? We have "book-asp.html", we don't need any > querystring here because this is a new location we have to redirect > to. Am I right?- Hide quoted text - > > - Show quoted text -
From: Alexey Smirnov on 25 Sep 2009 06:40 On Sep 25, 11:26 am, "Hemant" <Hem...(a)nomail.com> wrote: > Hi, > Thanks for reply > Here I am explain in detail what I want to do . > void Application_BeginRequest(object sender, EventArgs e) > { > > Here I pass book-asp.html to DataBase to get the ID where it match the > same name book-asp.html > If in my database there are two product in different category of same name > as book-asp.html . > or If i put the same product in two category than I got the wrong categoryid > so > I want to pass that category id from previous page so that i can fetch right > product with right categoryid. > > } > > that's why I want to pass a ID . > hope you can understand my problem. > Thanks, > Hemant > You can try to use Request.UrlReferrer.ToString() to get referrer url http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx But I think this could lead to a problem: when there is no referrer, you can't identify "right" categoryid, and users may not use direct url to that page. Search engines will have troubles with indexing...
From: Hemant on 25 Sep 2009 07:07 Hi, Thanks for this. As you say this is not good for search engines indexing than I don't want to use this because all of this is only for search engin indexing. Can you tell me that if i pass www.test.com/book-asp.html?id=100 or www.test.com/book-asp.html?100 will make any affect to the search engin indexing. If this does't make any trouble than i think my search ends here if not than i have to try more. thanks for your support and reply. thanks, hemant "Alexey Smirnov" <alexey.smirnov(a)gmail.com> wrote in message news:ff0d76b0-b8b2-4237-8b1f-d413379d8d6c(a)d34g2000vbm.googlegroups.com... On Sep 25, 11:26 am, "Hemant" <Hem...(a)nomail.com> wrote: > Hi, > Thanks for reply > Here I am explain in detail what I want to do . > void Application_BeginRequest(object sender, EventArgs e) > { > > Here I pass book-asp.html to DataBase to get the ID where it match the > same name book-asp.html > If in my database there are two product in different category of same name > as book-asp.html . > or If i put the same product in two category than I got the wrong > categoryid > so > I want to pass that category id from previous page so that i can fetch > right > product with right categoryid. > > } > > that's why I want to pass a ID . > hope you can understand my problem. > Thanks, > Hemant > You can try to use Request.UrlReferrer.ToString() to get referrer url http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx But I think this could lead to a problem: when there is no referrer, you can't identify "right" categoryid, and users may not use direct url to that page. Search engines will have troubles with indexing...
From: Alexey Smirnov on 25 Sep 2009 08:46 On Sep 25, 1:07 pm, "Hemant" <Hem...(a)nomail.com> wrote: > Hi, > Thanks for this. > As you say this is not good for search engines indexing than I don't want to > use this because all of this is only for search engin indexing. > Can you tell me that if i passwww.test.com/book-asp.html?id=100orwww.test.com/book-asp.html?100will make any affect to the search engin > indexing. > If this does't make any trouble than i think my search ends here if not > than i have to try more. > thanks for your support and reply. > thanks, > hemant"Alexey Smirnov" <alexey.smir...(a)gmail.com> wrote in message > > news:ff0d76b0-b8b2-4237-8b1f-d413379d8d6c(a)d34g2000vbm.googlegroups.com... > On Sep 25, 11:26 am, "Hemant" <Hem...(a)nomail.com> wrote: > > > > > > > Hi, > > Thanks for reply > > Here I am explain in detail what I want to do . > > void Application_BeginRequest(object sender, EventArgs e) > > { > > > Here I pass book-asp.html to DataBase to get the ID where it match the > > same name book-asp.html > > If in my database there are two product in different category of same name > > as book-asp.html . > > or If i put the same product in two category than I got the wrong > > categoryid > > so > > I want to pass that category id from previous page so that i can fetch > > right > > product with right categoryid. > > > } > > > that's why I want to pass a ID . > > hope you can understand my problem. > > Thanks, > > Hemant > > You can try to use Request.UrlReferrer.ToString() to get referrer urlhttp://msdn.microsoft.com/en-us/library/system.web.httprequest.urlref... > > But I think this could lead to a problem: when there is no referrer, > you can't identify "right" categoryid, and users may not use direct > url to that page. Search engines will have troubles with indexing...- Hide quoted text - > > - Show quoted text - If all this was for SEO, then you can leave it as it is. While Static URLs might have a slight advantage, Google and other major SE do not have any problems to index dynamic links, especially when you have just "page.aspx?id=100". Having ".html" instead of ".aspx" will not help too. If you definitely need it, you can consider one of the following links /Product100.aspx /100.aspx /100/Book.aspx /Product.aspx/100 Each link would work for well for users and SEO
From: Gregory A. Beamer on 25 Sep 2009 10:34 "Hemant" <Hemant(a)nomail.com> wrote in news:erBGQqZPKHA.1268(a)TK2MSFTNGP04.phx.gbl: > Hi , > Thanks for your replies. > I am doing url rewriting . > In Application_BeginRequest i want to get ID's of the string. > At this function I call the Context.Rewrite Path to Redirect the > correct page > What I need that I want to store that ID some where so that I can > pass that ID to the Right page. > For Example : > My URL is www.Test.com/book-asp.html > But the actual URL for this is www.Test.com/Product.aspx?ID = 100 > I want to get this ID at that function so that I can call the correct > page with correct ID. > Thanks, > Hemant The norm to URL rewrite is using an HTTP Handler rather than trying to write it in your ASP.NET application. There are plenty of web pages that describe setting up this type of URL rewrite. If you can go to 3.5 SP1, you can also use URL Routing, which will also be a part of .NET 4.0. Peace and Grace, -- Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com My vacation and childhood cancer awareness site: http://www.crazycancertour.com ******************************************* | Think outside the box! | *******************************************
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Windows Application Event 1309 Next: ListView ItemDatabound data |