How to strip out a url variable

前端 未结 5 2002

I have a url.LoginID, and I\'d like to remove it from the address bar when the user clicks on the link to login. It has to be a bookmark, it can\'t be a form submit.

<
5条回答
  •  情书的邮戳
    2020-12-10 20:37

    Suppose you don't really want to remove the ? to keep the URL valid, so simple regex should work:

    QUERY_STRING = ReReplaceNoCase(cgi.QUERY_STRING, "LoginID=.+\&", "");
    

    BTW, I'm not sure why do you keep LoginID in URL at all, it may be insecure approach. Using sessions sounds like a better idea.

    Edit: Ben's regex is better, because my version is so simple that will "eat" all key=value pairs before last one.

提交回复
热议问题