locked
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

    (GUID)

    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!

     

    Thanks. 

    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
    hi,
    read this article, its just what you want to do :

    http://dotnetbips.com/A2531B92-0710-46CD-80AB-CCE506D3A582.aspx?articleid=267

    Regards,

    Arshak
    Wednesday, July 6, 2005 2:30 AM