Click here to Skip to main content
15,905,566 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my friends I used datalist in webform and I will get image from the database.For this I used httphandler.

<asp:Image ID="Image1" runat="server" ImageUrl='<%# "../xxxxxxx.ashx?ImID=" + Eval("id")%>' Height="244px" Width="244px" EnableViewState="True" />

I send image id Eval("id") to httphandler with querystring.

is this a querystring security problem?????

how I hide id or how can protect injection or any attacks.
Posted

Quote:
ASP.NET
<asp:Image ID="Image1" runat="server" ImageUrl='<%# "../xxxxxxx.ashx?ImID=" + EncodeID(Eval("id"))%>' Height="244px" Width="244px" EnableViewState="True" />
Actually the ImageUrl after rendered on Browser, would refer to a Image Path rather than any ID.

That is because according to the code, it will dynamically bind the Path with the help of ID at Server side. There will be no trace of ID or any parameters at the client side Browser.
You can check the HTML of Image on Browser by Inspecting the Element.

However, if you want to protect the data, you can add some Encoding function and modify code as...
ASP.NET
<asp:Image ID="Image1" runat="server" ImageUrl='<%# "../xxxxxxx.ashx?ImID=" + EncodeID(Eval("id"))%>' Height="244px" Width="244px" EnableViewState="True" />

Here EncodeID() is a function at Code Behind, which would encode the ID and return you the Encoded ID.
 
Share this answer
 
Comments
Member-2338430 14-Feb-14 4:21am    
ok understood thanks a lot
Most Welcome buddy. :)

Please accept this answer, if it has helped you in any way.
This will help others to find the answer in one go and you will also be awarded with some points for this action...

Thanks,
Tadit
go through the below references

http://stackoverflow.com/questions/9110561/encrypt-query-string-including-keys

http://www.codeproject.com/Tips/583097/Global-Query-String-Encryption

http://www.codeproject.com/Articles/20147/Encrypt-a-Querystring-with-Expiration
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900