response.redirect and location.href

Results 1 to 3 of 3

Thread: response.redirect and location.href

  1. #1
    kams Guest

    Default response.redirect and location.href

    Hello!<BR>I&#039m using some COM objects in my ASP page and I&#039m promptly setting them to Nothing, after usage, in the page.But whenever I&#039m using Response.Redirect to redirect to another page,I&#039m setting the objects to Nothing there and then proceeding to next page.But what about window.location.href?How does this work exactly?If, suppose i have something like this:<BR>&#060;%if somevar = "a" then%&#062;<BR> &#060;script language="javascript"&#062;<BR> window.location.href = &#039Main.asp&#039<BR> &#060;/script&#062;<BR>&#060;%end if%&#062;<BR>should I set the objects to nothing here too?<BR>Hope you got what I&#039m trying to explain :)<BR>Thanks.<BR> <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: response.redirect and location.href

    the difference is that window.location.href works on the client, whereas Response.Redirect is server-based. I wouldn&#039t use the javascript method myself, it&#039s not really worth the hassle, and you may geta user with script turned off who gets stuck where he is. <BR><BR>COM objects are automatically destroyes by the server after the page is completed (i.e. it&#039s all been processed and sent to the client). the performance gain from setting your objects to nothing is useful if you set them to nothing as early as possible, and they&#039ll be released while the page is still processing. Setting them to nothing as the last thing you do on a page is still good practice, but much less of a gain<BR><BR>jason

  3. #3
    Igal Vorobeychik Guest

    Default RE: response.redirect and location.href

    The difference between Response.Redirect and window.location.href<BR>is that Response.Redirect activated on server and there is no HTML output will be done frome this page (remember using Response.Redirect could couse an error if you try to use any HTML output before to avoid this you should use Response.Clear and Response.Buffer = true befor your Redirect ).<BR>Using window.location.href technic to redirect user client does recive HTML + client Javascript and than Javascript redirects to another page.You should sett all your COM objects to nothing in the end of the page or after finishing to use them<BR><BR>-----some code<BR>&#060;%if somevar = "a" then%&#062;<BR>&#060;script language="javascript"&#062;<BR>window.location.hre f = &#039Main.asp&#039<BR>&#060;/script&#062;<BR>&#060;%end if%&#062;<BR>--- some code<BR>gobjCOM.SomeMethod<BR>Set gobjCOM = nothing<BR>---some code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts