ratsbane at gmail
Jul 11, 2011, 12:30 PM
Post #7 of 17
Much better to go with a more RESTful approach - the URL is the identifier
Re: Changing browser URL based on condition
[In reply to]
for the page and you don't want that identifier to represent the wrong page,
e.g. if example.com/login sometimes returns the home page and sometimes
returns some other page (assuming you can login from and return to multiple
Make it so that your home page (or any page) have a login form (or link
which expands to a login form) which POSTs to the login page (or to think of
it in a RESTful way, PUT to a "sessions" URL, thus defining the idea of
"create a new session" - except that browser forms have problems with PUT).
Then from the login page do a redirect to whatever was the referer.
On Mon, Jul 11, 2011 at 12:14 PM, Jerry Pereira <online.jerry [at] gmail>wrote:
> Hi Edward,
> I have the following design:
> A single PerlResponseHandler for all requests. This handler based on the
> path decides the action to be taken
> For example, if the user submits to www.example.com/login, then the
> handler delegates the request to authentication module, which will then
> either display the home page (throug home page template) or login page
> again, based on the success/failure of authentication mechanism. Since i am
> rendering the page via template, i am able to generate the content of home
> page which i then send back to the client, but the URL on the browser
> remails the same (i.e. www.example.com/login), which is not true. Any
> suggestions to handle this scenario will be great.
> On Mon, Jul 11, 2011 at 12:03 PM, Szekeres, Edward <
> Edward.Szekeres [at] perkinelmer> wrote:
>> If you are looking to do this for “cosmetic reasons”, I do this be
>> simply using frame sets and doing redirects in the child frame. The URL
>> displayed in the location bar will always be constant for the parent frame.
>> I don’t think there is any way to do this at the core level or it would be a
>> spoofers windfall. The browser will always have the actual location in the
>> info panel.****
>> ** **
>> *From:* Jerry Pereira [mailto:online.jerry [at] gmail]
>> *Sent:* Monday, July 11, 2011 2:48 PM
>> *To:* modperl [at] perl
>> *Subject:* Changing browser URL based on condition****
>> ** **
>> Hi All,****
>> I would like to know if there is a way to change the URL displayed on
>> browser without using Redirect option. The URL visible on client browser
>> must be based on some condition that is evaluated in my mod_perl handler.
>> For example -****
>> 1. User types the URL - www.example.com, this will display the login
>> 2. Once the user enters the credentials and hits submit, the request is
>> posted to www.example.com/login action.
>> 3. If the credentials entered by the user is valid then i would like to
>> the home page..uri
>> 4. I am able to show the homw page, but the URL does not change to
>> www.example.com/home, instead it remains the same (i.e.
>> www.example.com/login). I am using Template toolkit to render my pages. I
>> tried $req->url('/home'), but that does not change the browser URI.****
>> Any help will be appreciated.****
> Your clothes may be the latest in style but you aint completely dressed
> until you wear a smile!
> Keep smiling : )