Request.QueryString.Set() Read Only?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    Request.QueryString.Set() Read Only?

    Hi-

    I'd like to set values in the QueryString if I detect that a user submits a
    bad value, say... ?id=333 where there is no id '333', I would like to set it
    to '0' for example.
    I tried to use Request.QuerySt ring.Set("id", "0");

    it says it is Read Only. How can this be done? Why is there a Set() method
    if you can't use it?

    Thanks,
    Steve


  • Mark Fitzpatrick

    #2
    Re: Request.QuerySt ring.Set() Read Only?

    Steve,
    It has a Set method because the querystring is a
    NameValueCollec tion. Inherently, this has a Set method. The querystring
    overrides this and disables it. The querystring is basically non-touchable
    since you can't alter what is sent from the browser.

    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - FrontPage

    "Steve" <steve@nowhere. com> wrote in message
    news:%23d0GJxr2 DHA.2548@tk2msf tngp13.phx.gbl. ..[color=blue]
    > Hi-
    >
    > I'd like to set values in the QueryString if I detect that a user submits[/color]
    a[color=blue]
    > bad value, say... ?id=333 where there is no id '333', I would like to set[/color]
    it[color=blue]
    > to '0' for example.
    > I tried to use Request.QuerySt ring.Set("id", "0");
    >
    > it says it is Read Only. How can this be done? Why is there a Set()[/color]
    method[color=blue]
    > if you can't use it?
    >
    > Thanks,
    > Steve
    >
    >[/color]


    Comment

    • Guest's Avatar

      #3
      Re: Request.QuerySt ring.Set() Read Only?


      I have capture the query string like

      qs=request.quer ystring().tostr ing

      and then rebuilt the query string with modified values
      and response.redire ct(url & qs) to it



      [color=blue]
      >-----Original Message-----
      >Steve,
      > It has a Set method because the querystring is a
      >NameValueColle ction. Inherently, this has a Set method.[/color]
      The querystring[color=blue]
      >overrides this and disables it. The querystring is[/color]
      basically non-touchable[color=blue]
      >since you can't alter what is sent from the browser.
      >
      > Hope this helps,
      > Mark Fitzpatrick
      > Microsoft MVP - FrontPage
      >
      >"Steve" <steve@nowhere. com> wrote in message
      >news:%23d0GJxr 2DHA.2548@tk2ms ftngp13.phx.gbl ...[color=green]
      >> Hi-
      >>
      >> I'd like to set values in the QueryString if I detect[/color][/color]
      that a user submits[color=blue]
      >a[color=green]
      >> bad value, say... ?id=333 where there is no id '333', I[/color][/color]
      would like to set[color=blue]
      >it[color=green]
      >> to '0' for example.
      >> I tried to use Request.QuerySt ring.Set("id", "0");
      >>
      >> it says it is Read Only. How can this be done? Why is[/color][/color]
      there a Set()[color=blue]
      >method[color=green]
      >> if you can't use it?
      >>
      >> Thanks,
      >> Steve
      >>
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Guest's Avatar

        #4
        Re: Request.QuerySt ring.Set() Read Only?


        I have capture the query string like

        qs=request.quer ystring().tostr ing

        and then rebuilt the query string with modified values
        and response.redire ct(url & qs) to it



        [color=blue]
        >-----Original Message-----
        >Steve,
        > It has a Set method because the querystring is a
        >NameValueColle ction. Inherently, this has a Set method.[/color]
        The querystring[color=blue]
        >overrides this and disables it. The querystring is[/color]
        basically non-touchable[color=blue]
        >since you can't alter what is sent from the browser.
        >
        > Hope this helps,
        > Mark Fitzpatrick
        > Microsoft MVP - FrontPage
        >
        >"Steve" <steve@nowhere. com> wrote in message
        >news:%23d0GJxr 2DHA.2548@tk2ms ftngp13.phx.gbl ...[color=green]
        >> Hi-
        >>
        >> I'd like to set values in the QueryString if I detect[/color][/color]
        that a user submits[color=blue]
        >a[color=green]
        >> bad value, say... ?id=333 where there is no id '333', I[/color][/color]
        would like to set[color=blue]
        >it[color=green]
        >> to '0' for example.
        >> I tried to use Request.QuerySt ring.Set("id", "0");
        >>
        >> it says it is Read Only. How can this be done? Why is[/color][/color]
        there a Set()[color=blue]
        >method[color=green]
        >> if you can't use it?
        >>
        >> Thanks,
        >> Steve
        >>
        >>[/color]
        >
        >
        >.
        >[/color]

        Comment

        • Kevin Spencer

          #5
          Re: Request.QuerySt ring.Set() Read Only?

          You will also notice that when you make any change to "qs" that it doesn't
          change the Request.QuerySt ring value.

          --
          HTH,
          Kevin Spencer
          ..Net Developer
          Microsoft MVP
          Big things are made up
          of lots of little things.

          <anonymous@disc ussions.microso ft.com> wrote in message
          news:080601c3db 4f$1c5e7e80$a50 1280a@phx.gbl.. .[color=blue]
          >
          > I have capture the query string like
          >
          > qs=request.quer ystring().tostr ing
          >
          > and then rebuilt the query string with modified values
          > and response.redire ct(url & qs) to it
          >
          >
          >
          >[color=green]
          > >-----Original Message-----
          > >Steve,
          > > It has a Set method because the querystring is a
          > >NameValueColle ction. Inherently, this has a Set method.[/color]
          > The querystring[color=green]
          > >overrides this and disables it. The querystring is[/color]
          > basically non-touchable[color=green]
          > >since you can't alter what is sent from the browser.
          > >
          > > Hope this helps,
          > > Mark Fitzpatrick
          > > Microsoft MVP - FrontPage
          > >
          > >"Steve" <steve@nowhere. com> wrote in message
          > >news:%23d0GJxr 2DHA.2548@tk2ms ftngp13.phx.gbl ...[color=darkred]
          > >> Hi-
          > >>
          > >> I'd like to set values in the QueryString if I detect[/color][/color]
          > that a user submits[color=green]
          > >a[color=darkred]
          > >> bad value, say... ?id=333 where there is no id '333', I[/color][/color]
          > would like to set[color=green]
          > >it[color=darkred]
          > >> to '0' for example.
          > >> I tried to use Request.QuerySt ring.Set("id", "0");
          > >>
          > >> it says it is Read Only. How can this be done? Why is[/color][/color]
          > there a Set()[color=green]
          > >method[color=darkred]
          > >> if you can't use it?
          > >>
          > >> Thanks,
          > >> Steve
          > >>
          > >>[/color]
          > >
          > >
          > >.
          > >[/color][/color]


          Comment

          Working...