Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. System.NotSupportedException: Collection is read-only.

System.NotSupportedException: Collection is read-only.

Scheduled Pinned Locked Moved ASP.NET
helpquestionannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saltcode
    wrote on last edited by
    #1

    Hi, I have an httpmodule which am using to modify the value of my querystring parameter. What i did was to encrypt the value of the querystring parameter, am decrypting the parameter inside the BeginRequest event so my code behinde will have access to the plaintext. the issue is when retrieve the parameter into a NameValueCollection and try to use the Set method to update the parameter value i get this error. System.NotSupportedException: Collection is read-only. but i can't access the IsReadOnly property of the class. how do i update the decrypted parameter value to the querystring so i can have the plaintext in my code behind. Thanks in advance Lookman

    N 1 Reply Last reply
    0
    • S saltcode

      Hi, I have an httpmodule which am using to modify the value of my querystring parameter. What i did was to encrypt the value of the querystring parameter, am decrypting the parameter inside the BeginRequest event so my code behinde will have access to the plaintext. the issue is when retrieve the parameter into a NameValueCollection and try to use the Set method to update the parameter value i get this error. System.NotSupportedException: Collection is read-only. but i can't access the IsReadOnly property of the class. how do i update the decrypted parameter value to the querystring so i can have the plaintext in my code behind. Thanks in advance Lookman

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      AFAIK, query string collection is read only. So you can't assign anything to there. Instead ,you can rewrite the path with the new values required. Use Context.RewritePath

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      S 1 Reply Last reply
      0
      • N N a v a n e e t h

        AFAIK, query string collection is read only. So you can't assign anything to there. Instead ,you can rewrite the path with the new values required. Use Context.RewritePath

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        S Offline
        S Offline
        saltcode
        wrote on last edited by
        #3

        wat happens to the NameValueeCollection Set Method, wat is d use?

        N 1 Reply Last reply
        0
        • S saltcode

          wat happens to the NameValueeCollection Set Method, wat is d use?

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Set() won't work because the whole collection is read only. Your best bet is rewrite the path.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups