I can see that I may have failed to understand which files I need to include with the VS.Net application. I assume it is just the aspx file and the dll in the bin. For the inline code I assume it is just the aspx file.
The app is simple it reads a list into a list box and then displays an image when the use clicks on an item. The HTML works and the list box and image holder are displayed. However the script does not run (a response write in the first line is not displayed) just leaving the HTML output in IE. On the server it causes an undefined error.
This is the code section. Any help would be appreciated as I am going slowly mad with the time this is taking and I am getting knowhere.
Hey,
<%@dotnet.itags.org. Page Language="vb" Debug="false" AutoEventWireup="true" %>
<%@dotnet.itags.org. Import namespace ="System"%>
<%@dotnet.itags.org. Import namespace ="System.io"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
</HEAD>
<script language="vb" runat="server">
Dim PropertyArray(1, 1) As String
Dim NProperties As Short
Dim FileFolder As String = "e:\data\webs\innereye\files\"
Sub Page_Load(Src As Object, E As EventArgs)
'response.Write("Test")
Dim FD As String = filefolder & "coordinates.csv"
Dim Ch As Integer = File.Exists(FD)
Dim FDArray As String() = Nothing
Dim Line As String
Dim sw As StreamReader = New StreamReader(CStr(FD))
Dim I As Integer = -1
Addhandler listbox1.selectedIndexChanged, AddressOf Me.lbchange
'Dim T As Char = Chr(9)
Do
Line = sw.ReadLine
If Line = Nothing Then Exit Do
I = I + 1
Loop
NProperties = I
ReDim PropertyArray(NProperties, 1)
I = -1
sw.Close()
sw = New StreamReader(CStr(FD))
Do
Line = sw.ReadLine
If Line = Nothing Then Exit Do
I = I + 1
FDArray = Line.Split(Chr(9))
PropertyArray(I, 0) = FDArray(0)
PropertyArray(I, 1) = FDArray(1)
Loop
sw.Close()
If Not Page.IsPostBack Then
For I = 0 To NProperties
ListBox1.Items.Add(PropertyArray(I, 0))
Next
Dim NewImage = FileFolder & "PhotoMapReduced.jpg"
NMAP.ImageAlign = imagealign.top
NMAP.Width = unit.pixel(600)
NMAP.Height = unit.pixel(400)
NMAP.ImageUrl = NewImage
End If
End Sub
Public Sub LbChange(ByVal sender As Object, ByVal e As System.EventArgs)
Dim p = ListBox1.SelectedItem.Text
Dim i As ShortFor i = 0 To NProperties
If PropertyArray(i, 0) = p Then
Dim NewImage = FileFolder & PropertyArra
NMAP.ImageAlign = imagealign.top
NMAP.Width = unit.pixel(600)
NMAP.Height = unit.pixel(400)
NMAP.ImageUrl = NewImage
Exit For
End If
Next
End Sub
</script
Try deploying all of the files, and see if it works. I know with VS.NET, it creates .resx files, which should be included also.
Brian
I have been looking at some asp.net code which is suppossed to work when loaded into IE and this does not work either. It is present when you view the source but the script does not run. Perhaps its not my code but a question of the settings on IE. Any thoughts?
ASP.Net files ( .aspx) have to be served by IIS. you can not view a .aspx file directly ( like you can html) - Does your asp.net server already run web apps, or did you just set it up for this project ? If you just set it up - try running this command
at command prompt , navigate to C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
and run aspnet_regiis.exe -i
HTH
Just to clear up some of the issues here.
1. It transpired that there was a bug in the remote server and when this was fixed the page displayed.
2. I could not get an error message because I copied the instructions from the remote server error page - this told how to set up the web.config file - unfortunately the script example for custom errors is wrong - they state the setting should be "off" but its case sensative "Off"!
3. In order to display the project in IE I needed to to type in the file name using the localhost URL not just click on the page as I had been doing.
4. I found I could display the codebehind version of the file by including the file and the dll thats all that was needed.
All perfectly obvious now but not at the time.
Thanks for those that gave advice.
0 comments:
Post a Comment