Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Image verification

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike P - 25 Feb 2008 15:12 GMT
I am trying to generate an image on my login screen that the user must
enter the characters of in order to login successfully.  I have managed
to find a method that returns a bitmap, but I am not sure how to render
it to the page alongside the rest of the login page.  

Bitmap bmp = iv.generateImage(sTxt);

           
           Response.ContentType = "image/gif";
           bmp.Save(Response.OutputStream, ImageFormat.Gif);

           bmp.Dispose();

I guess I will need to switch Response.ContentType to also show the rest
of the page. What do I need to do to show both my image and the rest of
the page on screen?
Nicholas Paldino [.NET/C# MVP] - 25 Feb 2008 15:19 GMT
Mike,

   What you need to do is have an IMG tag in the login page that will
reference the page/URL that will dynamically generate the image.  You will
have to pass along any information in the URL that the page needs to
generate the image.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>I am trying to generate an image on my login screen that the user must
> enter the characters of in order to login successfully.  I have managed
[quoted text clipped - 13 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
Mike P - 25 Feb 2008 15:39 GMT
Nicholas,

If the image is being created on a separate page and then viewed through
an Image control on the Login page, how do I get at the string that is
created on the Image page so that I can verify that what the user types
in matches the string?
Jesse Houwing - 25 Feb 2008 15:55 GMT
Hello Mike,

> Nicholas,
>
> If the image is being created on a separate page and then viewed
> through an Image control on the Login page, how do I get at the string
> that is created on the Image page so that I can verify that what the
> user types in matches the string?

You can store it in the Session or the Viewstate.

--
Jesse Houwing
jesse.houwing at sogeti.nl
Nicholas Paldino [.NET/C# MVP] - 25 Feb 2008 15:56 GMT
Mike,

   Well, the login page is going to place the IMG tag in the page, right?
And you are using Session State or something in the query string to indicate
what the string used in the image should be.  The login page should be
generating this string, or the page generating the image should be placing
it in session state (I don't like this, because you might have multiple
requests in the same session hitting that variable, and it could cause
issues).

   Either way, the login page is aware of the string already.  I recommend
that the login page generates the string, and then passes it to the page
generating the image, using some sort of encryption key (I like generating a
hash using the ASP.NET session id and then using that as an encyrption key
across the session).

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Nicholas,
>
[quoted text clipped - 4 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
Mike P - 25 Feb 2008 16:10 GMT
Cheers!
Oddball - 25 Feb 2008 17:04 GMT
> Cheers!
>
> *** Sent via Developersdexhttp://www.developersdex.com***

The way I solved this was I used the Cache, stored my string in there
with a short expiery and a GUID as a key.  I passed the Guid to the
handler to genarate the CAPTCHA image - the handler then retrieved the
string from the Cache - minimal collision problems curtesy of Guid
immense phase space.  Isn't there more chance of winning every lottery
on the planet or something?

Your login page would be responsible for removing the string from the
cache, but the cache will do it itself after... say... five, ten
minutes? Long enough for the turboest of R-Type 'tards to work out
what's going on.
Lasse Vågsæther Karlsen - 25 Feb 2008 15:36 GMT
> I am trying to generate an image on my login screen that the user must
> enter the characters of in order to login successfully.  I have managed
[quoted text clipped - 14 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***

This piece of "technology" is called a CAPTHCA, so google for some examples.

Signature

Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3

Peter Bromberg [C# MVP] - 25 Feb 2008 19:05 GMT
Mike,
don't reinvent the wheel. Try this google search:

http://www.google.com/search?q=ASP.NET+CAPTCHA+CONTROL
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: htp://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net

> I am trying to generate an image on my login screen that the user must
> enter the characters of in order to login successfully.  I have managed
[quoted text clipped - 14 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.