Append a GUID to incoming Requests RRS feed

  • Question

  • User-2094597777 posted

    I have been trying to write an HTTPHandler to append an GUID to incoming requests to my website. I need to append a GUID to break any kind of caching I have only 1 page, so the GUID can remain the same on Subsequent request from the same client.

    I want to change http://www.mysite.com/Default.aspx

    To: http://www.mysite.com/Deafult.aspx?Id=3390-332329-29aa-a38s


    I want to refrain from doing a redirect from the initial page, also when I tried response.redirect from the handler class, I ended up in an infinite loop!



    Friday, May 20, 2005 3:32 PM

All replies

  • User-751653828 posted

    On the handler, why don't you have some basic code like:

    string url = HttpContext.Current.Request.RawUrl;
    Guid guid = Guid.NewGuid();

    if (HttpContext.Current.Request.QueryString["Id"] == null)
       HttpContext.Current.Response.Redirect(url + ((url.IndexOf('?') > 0) ? "&Id=" : "?Id=") + guid.ToString());

    Saturday, May 21, 2005 11:37 AM
  • User-182265138 posted
    read this article, its just what you want to do :



    Wednesday, July 6, 2005 2:30 AM