Click here to Skip to main content
15,896,726 members
Home / Discussions / Web Development
   

Web Development

 
QuestionRe: How to record how many users have downloaded my softwares? Pin
Iftikhar Ali21-Feb-06 20:38
Iftikhar Ali21-Feb-06 20:38 
Questioncalendar grid Pin
alxtech16-Feb-06 9:36
alxtech16-Feb-06 9:36 
QuestionPrinting web page in landscape Pin
idreesbadshah16-Feb-06 7:09
idreesbadshah16-Feb-06 7:09 
AnswerRe: Printing web page in landscape Pin
Dmitry Khudorozhkov17-Feb-06 7:46
Dmitry Khudorozhkov17-Feb-06 7:46 
GeneralRe: Printing web page in landscape Pin
idreesbadshah21-Feb-06 7:22
idreesbadshah21-Feb-06 7:22 
QuestionSelling Files Pin
LittleYellowBird16-Feb-06 7:00
LittleYellowBird16-Feb-06 7:00 
AnswerRe: Selling Files Pin
Iftikhar Ali16-Feb-06 20:42
Iftikhar Ali16-Feb-06 20:42 
QuestionHELP! - Class file appears to shared accross sessions? ASP VB.NET Pin
Morgan198116-Feb-06 6:21
Morgan198116-Feb-06 6:21 
Hello helpfull web guru who will hopefull know what is wrong!

I have a web app, that builds a graph according to survey data entered over several pages. The answers to these questions are saved to an SQL database. After the last question is answered, the page calls the following class:

Imports System.drawing<br />
Imports System.io<br />
<br />
Public Class StarMaker<br />
<br />
   Private picbox As New System.Windows.Forms.PictureBox<br />
<br />
   Private ax1pt As Point = New Point(181, 193)<br />
   Private ax2pt As Point = New Point(181, 193)<br />
   Private ax3pt As Point = New Point(181, 193)<br />
   Private ax4pt As Point = New Point(181, 193)<br />
   Private ax5pt As Point = New Point(181, 193)<br />
   Private ax6pt As Point = New Point(181, 193)<br />
   Private ax7pt As Point = New Point(181, 193)<br />
<br />
   Private ratio1 As Double<br />
   Private ratio2 As Double<br />
   Private ratio3 As Double<br />
   Private ratio4 As Double<br />
   Private ratio5 As Double<br />
   Private ratio6 As Double<br />
   Private ratio7 As Double<br />
<br />
   Private p_maxVal As Double<br />
   Private p_ax1 As Double<br />
   Private p_ax2 As Double<br />
   Private p_ax3 As Double<br />
   Private p_ax4 As Double<br />
   Private p_ax5 As Double<br />
   Private p_ax6 As Double<br />
   Private p_ax7 As Double<br />
<br />
   Private p_FileLoc As String<br />
   Private p_FileName As String<br />
<br />
   Public Property FileName() As String<br />
      Get<br />
         FileName = p_FileName & ".jpg"<br />
      End Get<br />
      Set(ByVal value As String)<br />
         p_FileName = value<br />
      End Set<br />
   End Property<br />
<br />
   Private Function colorCreator(ByVal h As String) As Color<br />
      If Mid(h, 1, 1) = "#" Then<br />
         Dim c As New ColorConverter<br />
         colorCreator = c.ConvertFromString(h)<br />
      Else<br />
         colorCreator = System.Drawing.Color.FromName(h)<br />
      End If<br />
   End Function<br />
<br />
   Public Sub DumpImage()<br />
      picbox.BackgroundImage = Drawing.Image.FromFile(System.Configuration.ConfigurationManager.AppSettings("TenantBackgroundImageLoc"))<br />
      Dim gfx As Graphics = Graphics.FromImage(picbox.BackgroundImage)<br />
<br />
      Dim col As Color = colorCreator("#AB0534")<br />
      Dim pen As Pen = New Pen(col, 3)<br />
<br />
      gfx.DrawLine(pen, ax1pt, ax2pt)<br />
      gfx.DrawLine(pen, ax2pt, ax3pt)<br />
      gfx.DrawLine(pen, ax3pt, ax4pt)<br />
      gfx.DrawLine(pen, ax4pt, ax5pt)<br />
      gfx.DrawLine(pen, ax5pt, ax6pt)<br />
      gfx.DrawLine(pen, ax6pt, ax7pt)<br />
      gfx.DrawLine(pen, ax7pt, ax1pt)<br />
<br />
      gfx.Flush()<br />
<br />
      picbox.Image = New Bitmap(400, 400, gfx)<br />
<br />
      picbox.Refresh()<br />
<br />
<br />
      p_FileName = System.Guid.NewGuid.ToString<br />
<br />
      Do Until File.Exists(p_FileLoc & "\" & p_FileName & ".jpg") = False<br />
         p_FileName = System.Guid.NewGuid.ToString<br />
      Loop<br />
<br />
      Dim img As Bitmap = picbox.BackgroundImage<br />
      Dim ms As New MemoryStream()<br />
      img.Save(ms, Imaging.ImageFormat.Jpeg)<br />
      Dim imgData(ms.Length - 1) As Byte<br />
      ms.Position = 0<br />
      ms.Read(imgData, 0, ms.Length)<br />
      Dim fs As New FileStream(p_FileLoc & p_FileName & ".jpg", FileMode.Create, FileAccess.Write)<br />
      fs.Write(imgData, 0, UBound(imgData))<br />
<br />
      fs.Close()<br />
      fs.Dispose()<br />
<br />
      ms.Close()<br />
      ms.Dispose()<br />
<br />
      img.Dispose()<br />
<br />
      picbox.Dispose()<br />
<br />
      pen.Dispose()<br />
<br />
      gfx.Dispose()<br />
   End Sub<br />
<br />
   Public Sub New(ByVal FileLoc As String, ByVal maxval As Double, ByVal ax1 As Double, ByVal ax2 As Double, ByVal ax3 As Double, ByVal ax4 As Double, ByVal ax5 As Double, ByVal ax6 As Double, ByVal ax7 As Double)<br />
      p_FileLoc = FileLoc<br />
      p_maxVal = maxval<br />
<br />
      p_ax1 = ax1<br />
      ratio1 = p_ax1 / p_maxVal<br />
      ax1pt.X = 181 + (0 * ratio1)<br />
      ax1pt.Y = 193 - (143 * ratio1)<br />
<br />
      p_ax2 = ax2<br />
      ratio2 = p_ax2 / p_maxVal<br />
      ax2pt.X = 181 + (112 * ratio2)<br />
      ax2pt.Y = 193 - (89 * ratio2)<br />
<br />
      p_ax3 = ax3<br />
      ratio3 = p_ax3 / p_maxVal<br />
      ax3pt.X = 181 + (139 * ratio3)<br />
      ax3pt.Y = 193 + (32 * ratio3)<br />
<br />
      p_ax4 = ax4<br />
      ratio4 = p_ax4 / p_maxVal<br />
      ax4pt.X = 181 + (62 * ratio4)<br />
      ax4pt.Y = 193 + (128 * ratio4)<br />
<br />
      p_ax5 = ax5<br />
      ratio5 = p_ax5 / p_maxVal<br />
      ax5pt.X = 181 - (63 * ratio5)<br />
      ax5pt.Y = 193 + (128 * ratio5)<br />
<br />
      p_ax6 = ax6<br />
      ratio6 = p_ax6 / p_maxVal<br />
      ax6pt.X = 181 - (140 * ratio6)<br />
      ax6pt.Y = 193 + (32 * ratio6)<br />
<br />
      p_ax7 = ax7<br />
      ratio7 = p_ax7 / p_maxVal<br />
      ax7pt.X = 181 - (113 * ratio7)<br />
      ax7pt.Y = 193 - (89 * ratio7)<br />
<br />
      DumpImage()<br />
   End Sub<br />
End Class


Which should draw the image, and save it to the HDD, and return the calling page with a GUID filename.

My problem occurs if two users are doing the test simultaneously. The class keeps drawing the first image over and over, completely ignoring any new parameters passed into the constructor?

Please help me if you know what I am doing wrong?Confused | :confused: The code below is the calling code on the page:

   Private Sub DisplaySpider()<br />
      Dim Ws As New IntranetWS.DataReader<br />
<br />
      Dim PercArr(7) As Integer<br />
      Dim x As Integer<br />
      Dim Perc1 As Integer<br />
      Dim Perc2 As Integer<br />
      Dim Perc3 As Integer<br />
      Dim ErStr As String = ""<br />
      For x = 1 To 7<br />
         Dim PercDs As DataSet = Ws.Pillar_Perc_Read(ConfigurationManager.AppSettings("ApplicationKey"), x, Session("LanguageId"), ErStr) ' Retrieve scores dataset from the database<br />
         If Not PercDs Is Nothing Then 'Build up values to pass to graphing class<br />
<br />
            Perc1 = PercDs.Tables(0).Rows(0)("AnswerFlag")<br />
            Perc2 = PercDs.Tables(0).Rows(1)("AnswerFlag")<br />
            Perc3 = PercDs.Tables(0).Rows(2)("AnswerFlag")<br />
            PercArr(x) = Perc1 + Perc2 + Perc3<br />
         Else<br />
            If ErStr = "" Then<br />
               ErStr = "Error Saving Data, please try again"<br />
            End If<br />
            Master.DisplayError(ErStr)<br />
            Exit Sub<br />
         End If<br />
      Next x<br />
<br />
      Dim star As New StarMaker.StarMaker(ConfigurationManager.AppSettings("StarFolder"), 15, PercArr(1), PercArr(2), PercArr(3), PercArr(4), PercArr(5), PercArr(6), PercArr(7)) ' create instance of graphing class, passing in parameters for plotting<br />
<br />
      Dim filename As String = star.FileName ' get GUID filename<br />
      If Not Ws.BrandToolPicture_Save(ConfigurationManager.AppSettings("ApplicationKey"), Session("UserId"), filename, ErStr) Then ' Save filname agains userID in the database<br />
         If ErStr = "" Then<br />
            ErStr = "Unknown error saving BrandToolPicture."<br />
         End If<br />
         Master.DisplayError(ErStr)<br />
         Exit Sub<br />
      End If<br />
      Response.Redirect("BrandToolImage.aspx") 'Open Report which displays image & scores<br />
<br />
   End Sub


Thanks
Michael - The guy breaking out in a cold sweat.
Questionpublish my web project in LAN Pin
kenny923915-Feb-06 22:38
kenny923915-Feb-06 22:38 
AnswerRe: publish my web project in LAN Pin
Curtis Schlak.16-Feb-06 13:12
Curtis Schlak.16-Feb-06 13:12 
QuestionAsynchronous web search Pin
sammyl3315-Feb-06 7:48
sammyl3315-Feb-06 7:48 
AnswerRe: Asynchronous web search Pin
Shog915-Feb-06 8:40
sitebuilderShog915-Feb-06 8:40 
GeneralRe: Asynchronous web search Pin
sammyl3315-Feb-06 12:13
sammyl3315-Feb-06 12:13 
QuestionDetect Windows XP SP2 Pin
Chintoo72315-Feb-06 1:59
Chintoo72315-Feb-06 1:59 
AnswerRe: Detect Windows XP SP2 Pin
DJLarZ16-Feb-06 2:55
DJLarZ16-Feb-06 2:55 
Questionbeginner problem with databinding Pin
Bart Blommerde14-Feb-06 22:30
Bart Blommerde14-Feb-06 22:30 
AnswerRe: beginner problem with databinding Pin
Bart Blommerde15-Feb-06 9:47
Bart Blommerde15-Feb-06 9:47 
GeneralRe: beginner problem with databinding Pin
George L. Jackson15-Feb-06 13:19
George L. Jackson15-Feb-06 13:19 
Questionproblem in Insert Querey on ASP page Pin
Murtuza Husain Miyan Patel14-Feb-06 21:11
professionalMurtuza Husain Miyan Patel14-Feb-06 21:11 
AnswerRe: problem in Insert Querey on ASP page Pin
Guffa14-Feb-06 21:57
Guffa14-Feb-06 21:57 
AnswerRe: problem in Insert Querey on ASP page Pin
George L. Jackson15-Feb-06 13:25
George L. Jackson15-Feb-06 13:25 
QuestionUPnP media server Pin
bijeesh114-Feb-06 19:55
bijeesh114-Feb-06 19:55 
QuestionScripting Languages Pin
JimmyRopes14-Feb-06 10:43
professionalJimmyRopes14-Feb-06 10:43 
AnswerRe: Scripting Languages Pin
Jeremy Thornton14-Feb-06 12:06
Jeremy Thornton14-Feb-06 12:06 
GeneralRe: Scripting Languages Pin
JimmyRopes14-Feb-06 20:44
professionalJimmyRopes14-Feb-06 20:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.