Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Disguising/encrypting a querystring variable

Reply
Thread Tools

Disguising/encrypting a querystring variable

 
 
D. Shane Fowlkes
Guest
Posts: n/a
 
      12-03-2004
I'm trying to come up with a simple approach to disguise or encrypt a
querystring variable . The variable is a record ID. To my surprise, I'm
not having much luck finding a solution. I've been to www.asp.net and
googled some and wasn't able to come up with a simple and realistic
solution.

I have a master page that lists records and then a details page pulls
detailed data from tables in the database. The page needs details page must
have a QS variable passed to it like "details.aspx?id=100". The master page
is populated based upon who is viewing it so therefore, not everyone will
see the same list. What I'm trying to prevent is having someone simply
replace the variable in the querystring with another one and view someone
else's detailed data.

I simply want to disguise the variable on the sending page to anything like
"details.aspx?id=ahiyne090793097hjkd" and then be able to "uncode" it or
read it on the receiving page. Make sense?

It's there a fairly simple and effective solution to doing this? Anything
that I've found out there just seemed to involve tons of custom class
writing (beyond me) and a lot of overkill. It doesn't need to be super
secure.....just disguised.

TIA




 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      12-03-2004
There's a great article with code written that can help handle this. Check
out:
http://www.dotnetjunkies.com/HowTo/9...75836DC72.dcik

I've found it works veyr nicely.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"D. Shane Fowlkes" <> wrote in message
news:%...
> I'm trying to come up with a simple approach to disguise or encrypt a
> querystring variable . The variable is a record ID. To my surprise, I'm
> not having much luck finding a solution. I've been to www.asp.net and
> googled some and wasn't able to come up with a simple and realistic
> solution.
>
> I have a master page that lists records and then a details page pulls
> detailed data from tables in the database. The page needs details page
> must
> have a QS variable passed to it like "details.aspx?id=100". The master
> page
> is populated based upon who is viewing it so therefore, not everyone will
> see the same list. What I'm trying to prevent is having someone simply
> replace the variable in the querystring with another one and view someone
> else's detailed data.
>
> I simply want to disguise the variable on the sending page to anything
> like
> "details.aspx?id=ahiyne090793097hjkd" and then be able to "uncode" it or
> read it on the receiving page. Make sense?
>
> It's there a fairly simple and effective solution to doing this? Anything
> that I've found out there just seemed to involve tons of custom class
> writing (beyond me) and a lot of overkill. It doesn't need to be super
> secure.....just disguised.
>
> TIA
>
>
>
>



 
Reply With Quote
 
 
 
 
Random
Guest
Posts: n/a
 
      12-03-2004
Why don't you create a couple of global functions for your application
(doesn't need to involve a custom class or anything) that you call to
encrypt and decrypt the ID as needed? You'd decide on and implement your
encryption scheme within these functions.

Another way, albeit a little more complicated, would be to hash the ID value
and store it as a secondary key within the database.


"D. Shane Fowlkes" <> wrote in message
news:%...
> I'm trying to come up with a simple approach to disguise or encrypt a
> querystring variable . The variable is a record ID. To my surprise, I'm
> not having much luck finding a solution. I've been to www.asp.net and
> googled some and wasn't able to come up with a simple and realistic
> solution.
>
> I have a master page that lists records and then a details page pulls
> detailed data from tables in the database. The page needs details page
> must
> have a QS variable passed to it like "details.aspx?id=100". The master
> page
> is populated based upon who is viewing it so therefore, not everyone will
> see the same list. What I'm trying to prevent is having someone simply
> replace the variable in the querystring with another one and view someone
> else's detailed data.
>
> I simply want to disguise the variable on the sending page to anything
> like
> "details.aspx?id=ahiyne090793097hjkd" and then be able to "uncode" it or
> read it on the receiving page. Make sense?
>
> It's there a fairly simple and effective solution to doing this? Anything
> that I've found out there just seemed to involve tons of custom class
> writing (beyond me) and a lot of overkill. It doesn't need to be super
> secure.....just disguised.
>
> TIA
>
>
>
>



 
Reply With Quote
 
Hans Kesting
Guest
Posts: n/a
 
      12-03-2004
D. Shane Fowlkes wrote:
> I'm trying to come up with a simple approach to disguise or encrypt a
> querystring variable . The variable is a record ID. To my surprise,
> I'm not having much luck finding a solution. I've been to
> www.asp.net and googled some and wasn't able to come up with a simple
> and realistic solution.
>
> I have a master page that lists records and then a details page pulls
> detailed data from tables in the database. The page needs details
> page must have a QS variable passed to it like "details.aspx?id=100".
> The master page is populated based upon who is viewing it so
> therefore, not everyone will see the same list. What I'm trying to
> prevent is having someone simply replace the variable in the
> querystring with another one and view someone else's detailed data.
>
> I simply want to disguise the variable on the sending page to
> anything like "details.aspx?id=ahiyne090793097hjkd" and then be able
> to "uncode" it or read it on the receiving page. Make sense?
>
> It's there a fairly simple and effective solution to doing this?
> Anything that I've found out there just seemed to involve tons of
> custom class writing (beyond me) and a lot of overkill. It doesn't
> need to be super secure.....just disguised.
>
> TIA


You could try to use a guid (uniqueidentifier in sqlserver) instead of
an autonumber id. Then the "hackers" can't just "add 1" and hope
to get a real id.

Hans Kesting


 
Reply With Quote
 
D. Shane Fowlkes
Guest
Posts: n/a
 
      12-03-2004
Great. Thanks! Is this in C#? I'm used to VB.NET so the syntax looks a
little off to me. I'll do my best to convert it and try it out. I may be
back on Monday for more help. =)



"Mark Fitzpatrick" <> wrote in message
news:%...
> There's a great article with code written that can help handle this. Check
> out:
>

http://www.dotnetjunkies.com/HowTo/9...75836DC72.dcik
>
> I've found it works veyr nicely.
>
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - FrontPage
>
> "D. Shane Fowlkes" <> wrote in message
> news:%...
> > I'm trying to come up with a simple approach to disguise or encrypt a
> > querystring variable . The variable is a record ID. To my surprise,

I'm
> > not having much luck finding a solution. I've been to www.asp.net and
> > googled some and wasn't able to come up with a simple and realistic
> > solution.
> >
> > I have a master page that lists records and then a details page pulls
> > detailed data from tables in the database. The page needs details page
> > must
> > have a QS variable passed to it like "details.aspx?id=100". The master
> > page
> > is populated based upon who is viewing it so therefore, not everyone

will
> > see the same list. What I'm trying to prevent is having someone simply
> > replace the variable in the querystring with another one and view

someone
> > else's detailed data.
> >
> > I simply want to disguise the variable on the sending page to anything
> > like
> > "details.aspx?id=ahiyne090793097hjkd" and then be able to "uncode" it or
> > read it on the receiving page. Make sense?
> >
> > It's there a fairly simple and effective solution to doing this?

Anything
> > that I've found out there just seemed to involve tons of custom class
> > writing (beyond me) and a lot of overkill. It doesn't need to be super
> > secure.....just disguised.
> >
> > TIA
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Joe Fallon
Guest
Posts: n/a
 
      12-05-2004
Why not forget about using a QS?
Just create a session variable on Page1 and pull it out on Page2.
--
Joe Fallon



"D. Shane Fowlkes" <> wrote in message
news:%...
> I'm trying to come up with a simple approach to disguise or encrypt a
> querystring variable . The variable is a record ID. To my surprise, I'm
> not having much luck finding a solution. I've been to www.asp.net and
> googled some and wasn't able to come up with a simple and realistic
> solution.
>
> I have a master page that lists records and then a details page pulls
> detailed data from tables in the database. The page needs details page
> must
> have a QS variable passed to it like "details.aspx?id=100". The master
> page
> is populated based upon who is viewing it so therefore, not everyone will
> see the same list. What I'm trying to prevent is having someone simply
> replace the variable in the querystring with another one and view someone
> else's detailed data.
>
> I simply want to disguise the variable on the sending page to anything
> like
> "details.aspx?id=ahiyne090793097hjkd" and then be able to "uncode" it or
> read it on the receiving page. Make sense?
>
> It's there a fairly simple and effective solution to doing this? Anything
> that I've found out there just seemed to involve tons of custom class
> writing (beyond me) and a lot of overkill. It doesn't need to be super
> secure.....just disguised.
>
> TIA
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
How to get value of QueryString inside QueryString Mehdi ASP .Net 6 04-06-2006 03:41 PM
Passing QueryString URL as a paremeter in QueryString Adeel Ahmad ASP General 1 03-07-2006 02:05 PM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM
datagrid to generate additional querystring collection item to pull off on the target page for input into a condition statement test variable...?? Hazzard ASP .Net 1 04-02-2004 06:48 PM



Advertisments