Saturday, March 31, 2012
The ASPX name
Inside an .aspx code, what would be the reliable way to know what is the
..aspx page file name on IIS?
Thanks,
Ali> Inside an .aspx code, what would be the reliable way to know what is the
> .aspx page file name on IIS?
Request.ServerVariables["SCRIPT_NAME"] would return the base name. You can
combine it with Request.ServerVariables["SERVER_NAME"] and a "http://"
prefix to get the full url.
This is C#, you should replace brackets with parentheses for VB.
Here's another:
string myPath = Page.Request.Path;
string pageName = myPath.Substring(myPath.LastIndexOf('/') + 1);
Michael Earls
"A.M" <IHateSpam@dotnet.itags.org.sapm123.com> wrote in message
news:uhiYpoB5DHA.3848@dotnet.itags.org.TK2MSFTNGP11.phx.gbl...
> Hi,
> Inside an .aspx code, what would be the reliable way to know what is the
> .aspx page file name on IIS?
> Thanks,
> Ali
>> Inside an .aspx code, what would be the reliable way to know what is the
>> .aspx page file name on IIS?
> string myPath = Page.Request.Path;
> string pageName = myPath.Substring(myPath.LastIndexOf('/') + 1);
That would actually be the pretty way, I gave you the old and ugly way.
Martin.
The beginning.
I have a file 'WeatherPage.aspx' with the following code, basic stuff:
<%@dotnet.itags.org. Page language="VB" %>
<script runat="server"
Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function
</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html
my operating system is Windows XP profesional. I use Internet Information
Services 5.1 (IIS).
When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I be
doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?
Thanks.The browser does give an error: Line 4, ";" is expected.
Isn't ";" used for "C#".
Page language is set to "VB".
"Qwert" <nosp@dotnet.itags.org.nosp.com> schreef in bericht
news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
> Ok,
> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
> <%@dotnet.itags.org. Page language="VB" %>
> <script runat="server">
> Shared rand As Random = New Random()
> Function GetForecast(zip As String) As String
> Dim ret As String = String.Empty
> Select rand.Next(5)
> Case 0
> ret = "Sunny and warm"
> Case 1
> ret = "Partly cloudy and chilly"
> Case 2
> ret = "Cold with a chance of snow"
> Case 3
> ret = "Rain"
> Case 4
> ret = "Foggy and damp"
> End Select
> Return ret
> End Function
> </script>
> <html>
> <body>
> <h1>My weather forecast page</h1>
> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
> </body>
> </html>
>
> my operating system is Windows XP profesional. I use Internet Information
> Services 5.1 (IIS).
> When I run this page in a webbrowser, the function 'GetForecast' doesn't
> display anything ( no error's). All I see is the HTML text. What can I be
> doing wrong? I got this code from a tutorial.
> Is the code incorrect? Can IIS have incorrect settings?
> Thanks.
You need to enclose your frunctions within
Sub
End Sub
statements.
If you want the code to execut automatically
when the page loads, use Sub Page_Load :
<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)
...rest of your code
End Sub
<//script
best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
> Ok,
> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
> <%@dotnet.itags.org. Page language="VB" %>
> <script runat="server"
> Shared rand As Random = New Random()
> Function GetForecast(zip As String) As String
> Dim ret As String = String.Empty
> Select rand.Next(5)
> Case 0
> ret = "Sunny and warm"
> Case 1
> ret = "Partly cloudy and chilly"
> Case 2
> ret = "Cold with a chance of snow"
> Case 3
> ret = "Rain"
> Case 4
> ret = "Foggy and damp"
> End Select
> Return ret
> End Function
> </script>
> <html>
> <body>
> <h1>My weather forecast page</h1>
> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
> </body>
> </html>
>
> my operating system is Windows XP profesional. I use Internet Information
> Services 5.1 (IIS).
> When I run this page in a webbrowser, the function 'GetForecast' doesn't
> display anything ( no error's). All I see is the HTML text. What can I be
> doing wrong? I got this code from a tutorial.
> Is the code incorrect? Can IIS have incorrect settings?
> Thanks.
You mean something like this, it does not work either:
<html
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Message.Text = "You last accessed this page at: " & DateTime.Now
End Sub
</script
<body>
<h3><font face="Verdana">Manipulating Server Controls</font></h3>
This sample demonstrates how to manipulate the <asp:label>
server control within
the Page_Load event to output the current time.
<p>
<hr>
<asp:label id="Message" font-size="24" font-bold="true"
runat=server/>
</body>
</html
I see the HTML in the browser, but not the Message.Text in the label
control.
"Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> schreef in bericht
news:ew9vH$uKFHA.1948@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> You need to enclose your frunctions within
> Sub
> End Sub
> statements.
> If you want the code to execut automatically
> when the page loads, use Sub Page_Load :
> <script runat="server">
> Sub Page_Load(Src as Object, e As System.EventArgs)
> ...rest of your code
> End Sub
> <//script>
> best,
>
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
> news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
>> Ok,
>>
>> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
>>
>> <%@dotnet.itags.org. Page language="VB" %>
>> <script runat="server">
>> Shared rand As Random = New Random()
>> Function GetForecast(zip As String) As String
>> Dim ret As String = String.Empty
>> Select rand.Next(5)
>> Case 0
>> ret = "Sunny and warm"
>> Case 1
>> ret = "Partly cloudy and chilly"
>> Case 2
>> ret = "Cold with a chance of snow"
>> Case 3
>> ret = "Rain"
>> Case 4
>> ret = "Foggy and damp"
>> End Select
>> Return ret
>> End Function
>>
>> </script>
>> <html>
>> <body>
>> <h1>My weather forecast page</h1>
>> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
>> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
>> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
>> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
>> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
>> </body>
>> </html>
>>
>>
>> my operating system is Windows XP profesional. I use Internet Information
>> Services 5.1 (IIS).
>>
>> When I run this page in a webbrowser, the function 'GetForecast' doesn't
>> display anything ( no error's). All I see is the HTML text. What can I be
>> doing wrong? I got this code from a tutorial.
>> Is the code incorrect? Can IIS have incorrect settings?
>>
>> Thanks.
I just pasted your code into
http://asp.net.do/test/vbtest2.aspx
It works fine.
Are you using http://localhost/virtualdirectory/yourfile.aspx ?
Or http://localhost/yourfile.aspx ?
Or http://YourComputerName/virtualdirectory/yourfile.aspx ?
Or http://yourserver.com/directory/yourfile.aspx ?
If you are, and it still doesn't work, try re-registering ASP.NET
from the .NET framework's main directory :
aspnet_regiis -i
( You did install the .NET Framework, right ? )
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
news:CpOdnY2NHqHpHKTfRVnyiw@dotnet.itags.org.casema.nl...
> You mean something like this, it does not work either:
> <html>
> <script language="VB" runat="server">
> Sub Page_Load(Sender As Object, E As EventArgs)
> Message.Text = "You last accessed this page at: " &
> DateTime.Now
> End Sub
> </script>
> <body>
> <h3><font face="Verdana">Manipulating Server Controls</font></h3>
> This sample demonstrates how to manipulate the <asp:label>
> server control within
> the Page_Load event to output the current time.
> <p>
> <hr>
> <asp:label id="Message" font-size="24" font-bold="true"
> runat=server/>
> </body>
> </html>
>
> I see the HTML in the browser, but not the Message.Text in the label
> control.
>
> "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> schreef in bericht
> news:ew9vH$uKFHA.1948@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>> You need to enclose your frunctions within
>>
>> Sub
>>
>> End Sub
>>
>> statements.
>>
>> If you want the code to execut automatically
>> when the page loads, use Sub Page_Load :
>>
>> <script runat="server">
>> Sub Page_Load(Src as Object, e As System.EventArgs)
>>
>> ...rest of your code
>>
>> End Sub
>> <//script>
>>
>> best,
>>
>>
>> Juan T. Llibre
>> ASP.NET MVP
>> http://asp.net.do/foros/
>> Foros de ASP.NET en Espaol
>> Ven, y hablemos de ASP.NET...
>> ======================
>>
>> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
>> news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
>>> Ok,
>>>
>>> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
>>>
>>> <%@dotnet.itags.org. Page language="VB" %>
>>> <script runat="server">
>>
>>> Shared rand As Random = New Random()
>>> Function GetForecast(zip As String) As String
>>> Dim ret As String = String.Empty
>>> Select rand.Next(5)
>>> Case 0
>>> ret = "Sunny and warm"
>>> Case 1
>>> ret = "Partly cloudy and chilly"
>>> Case 2
>>> ret = "Cold with a chance of snow"
>>> Case 3
>>> ret = "Rain"
>>> Case 4
>>> ret = "Foggy and damp"
>>> End Select
>>> Return ret
>>> End Function
>>>
>>> </script>
>>> <html>
>>> <body>
>>> <h1>My weather forecast page</h1>
>>> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
>>> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
>>> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
>>> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
>>> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
>>> </body>
>>> </html>
>>>
>>>
>>> my operating system is Windows XP profesional. I use Internet
>>> Information Services 5.1 (IIS).
>>>
>>> When I run this page in a webbrowser, the function 'GetForecast' doesn't
>>> display anything ( no error's). All I see is the HTML text. What can I
>>> be doing wrong? I got this code from a tutorial.
>>> Is the code incorrect? Can IIS have incorrect settings?
>>>
>>> Thanks.
>>
>>
> If you are, and it still doesn't work, try re-registering ASP.NET
> from the .NET framework's main directory :
> aspnet_regiis -i
It worked....but weird. Someone already installed .NET Framework. Doesn't
make sense ASP.NET needs a seperate installement...I wasn't there when it
was installed on my comp, maybe you can select an option during installation
that you don't want to install ASP.NET.
3 cheers for spain!
Thanks.
> ( You did install the .NET Framework, right ? )
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
> news:CpOdnY2NHqHpHKTfRVnyiw@dotnet.itags.org.casema.nl...
>> You mean something like this, it does not work either:
>>
>> <html>
>>
>> <script language="VB" runat="server">
>> Sub Page_Load(Sender As Object, E As EventArgs)
>> Message.Text = "You last accessed this page at: " &
>> DateTime.Now
>> End Sub
>> </script>
>>
>> <body>
>> <h3><font face="Verdana">Manipulating Server Controls</font></h3>
>> This sample demonstrates how to manipulate the <asp:label>
>> server control within
>> the Page_Load event to output the current time.
>> <p>
>> <hr>
>> <asp:label id="Message" font-size="24" font-bold="true"
>> runat=server/>
>> </body>
>> </html>
>>
>>
>> I see the HTML in the browser, but not the Message.Text in the label
>> control.
>>
>>
>> "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> schreef in bericht
>> news:ew9vH$uKFHA.1948@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>>> You need to enclose your frunctions within
>>>
>>> Sub
>>>
>>> End Sub
>>>
>>> statements.
>>>
>>> If you want the code to execut automatically
>>> when the page loads, use Sub Page_Load :
>>>
>>> <script runat="server">
>>> Sub Page_Load(Src as Object, e As System.EventArgs)
>>>
>>> ...rest of your code
>>>
>>> End Sub
>>> <//script>
>>>
>>> best,
>>>
>>>
>>> Juan T. Llibre
>>> ASP.NET MVP
>>> http://asp.net.do/foros/
>>> Foros de ASP.NET en Espaol
>>> Ven, y hablemos de ASP.NET...
>>> ======================
>>>
>>> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
>>> news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
>>>> Ok,
>>>>
>>>> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
>>>>
>>>> <%@dotnet.itags.org. Page language="VB" %>
>>>> <script runat="server">
>>>
>>>> Shared rand As Random = New Random()
>>>> Function GetForecast(zip As String) As String
>>>> Dim ret As String = String.Empty
>>>> Select rand.Next(5)
>>>> Case 0
>>>> ret = "Sunny and warm"
>>>> Case 1
>>>> ret = "Partly cloudy and chilly"
>>>> Case 2
>>>> ret = "Cold with a chance of snow"
>>>> Case 3
>>>> ret = "Rain"
>>>> Case 4
>>>> ret = "Foggy and damp"
>>>> End Select
>>>> Return ret
>>>> End Function
>>>>
>>>> </script>
>>>> <html>
>>>> <body>
>>>> <h1>My weather forecast page</h1>
>>>> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
>>>> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
>>>> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
>>>> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
>>>> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
>>>> </body>
>>>> </html>
>>>>
>>>>
>>>> my operating system is Windows XP profesional. I use Internet
>>>> Information Services 5.1 (IIS).
>>>>
>>>> When I run this page in a webbrowser, the function 'GetForecast'
>>>> doesn't display anything ( no error's). All I see is the HTML text.
>>>> What can I be doing wrong? I got this code from a tutorial.
>>>> Is the code incorrect? Can IIS have incorrect settings?
>>>>
>>>> Thanks.
>>>
>>>
>>
>>
re:
> Thanks.
You're very much welcome!
Glad it worked!
re:
> Someone already installed .NET Framework. Doesn't make sense ASP.NET needs
> a seperate installement.
Maybe someone uninstalled/reinstalled IIS ?
That would require re-registering ASP.NET with the new IIS.
re:
> 3 cheers for spain!
Make that the Dominican Republic... ;-)
Happy coding!
Don't let the bug(ger)s get you!
:-)
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
news:-b6dnYlGzYMPDaTfRVnyiw@dotnet.itags.org.casema.nl...
>> If you are, and it still doesn't work, try re-registering ASP.NET
>> from the .NET framework's main directory :
>>
>> aspnet_regiis -i
> It worked....but weird. Someone already installed .NET Framework. Doesn't
> make sense ASP.NET needs a seperate installement...I wasn't there when it
> was installed on my comp, maybe you can select an option during
> installation that you don't want to install ASP.NET.
> 3 cheers for spain!
> Thanks.
>> ( You did install the .NET Framework, right ? )
>>
>> Juan T. Llibre
>> ASP.NET MVP
>> http://asp.net.do/foros/
>> Foros de ASP.NET en Espaol
>> Ven, y hablemos de ASP.NET...
>> ======================
>>
>> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
>> news:CpOdnY2NHqHpHKTfRVnyiw@dotnet.itags.org.casema.nl...
>>> You mean something like this, it does not work either:
>>>
>>> <html>
>>>
>>> <script language="VB" runat="server">
>>> Sub Page_Load(Sender As Object, E As EventArgs)
>>> Message.Text = "You last accessed this page at: " &
>>> DateTime.Now
>>> End Sub
>>> </script>
>>>
>>> <body>
>>> <h3><font face="Verdana">Manipulating Server Controls</font></h3>
>>> This sample demonstrates how to manipulate the <asp:label>
>>> server control within
>>> the Page_Load event to output the current time.
>>> <p>
>>> <hr>
>>> <asp:label id="Message" font-size="24" font-bold="true"
>>> runat=server/>
>>> </body>
>>> </html>
>>>
>>>
>>> I see the HTML in the browser, but not the Message.Text in the label
>>> control.
>>>
>>>
>>> "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> schreef in bericht
>>> news:ew9vH$uKFHA.1948@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>>>> You need to enclose your frunctions within
>>>>
>>>> Sub
>>>>
>>>> End Sub
>>>>
>>>> statements.
>>>>
>>>> If you want the code to execut automatically
>>>> when the page loads, use Sub Page_Load :
>>>>
>>>> <script runat="server">
>>>> Sub Page_Load(Src as Object, e As System.EventArgs)
>>>>
>>>> ...rest of your code
>>>>
>>>> End Sub
>>>> <//script>
>>>>
>>>> best,
>>>>
>>>>
>>>> Juan T. Llibre
>>>> ASP.NET MVP
>>>> http://asp.net.do/foros/
>>>> Foros de ASP.NET en Espaol
>>>> Ven, y hablemos de ASP.NET...
>>>> ======================
>>>>
>>>> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
>>>> news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
>>>>> Ok,
>>>>>
>>>>> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
>>>>>
>>>>> <%@dotnet.itags.org. Page language="VB" %>
>>>>> <script runat="server">
>>>>
>>>>> Shared rand As Random = New Random()
>>>>> Function GetForecast(zip As String) As String
>>>>> Dim ret As String = String.Empty
>>>>> Select rand.Next(5)
>>>>> Case 0
>>>>> ret = "Sunny and warm"
>>>>> Case 1
>>>>> ret = "Partly cloudy and chilly"
>>>>> Case 2
>>>>> ret = "Cold with a chance of snow"
>>>>> Case 3
>>>>> ret = "Rain"
>>>>> Case 4
>>>>> ret = "Foggy and damp"
>>>>> End Select
>>>>> Return ret
>>>>> End Function
>>>>>
>>>>> </script>
>>>>> <html>
>>>>> <body>
>>>>> <h1>My weather forecast page</h1>
>>>>> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
>>>>> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
>>>>> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
>>>>> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
>>>>> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>>
>>>>> my operating system is Windows XP profesional. I use Internet
>>>>> Information Services 5.1 (IIS).
>>>>>
>>>>> When I run this page in a webbrowser, the function 'GetForecast'
>>>>> doesn't display anything ( no error's). All I see is the HTML text.
>>>>> What can I be doing wrong? I got this code from a tutorial.
>>>>> Is the code incorrect? Can IIS have incorrect settings?
>>>>>
>>>>> Thanks.
>>>>
>>>>
>>>
>>>
>>
>>
The beginning.
I have a file 'WeatherPage.aspx' with the following code, basic stuff:
<%@dotnet.itags.org. Page language="VB" %>
<script runat="server">
Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function
</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet Information
Services 5.1 (IIS).
When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I be
doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?
Thanks.The browser does give an error: Line 4, ";" is expected.
Isn't ";" used for "C#".
Page language is set to "VB".
"Qwert" <nosp@dotnet.itags.org.nosp.com> schreef in bericht
news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
> Ok,
> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
> <%@dotnet.itags.org. Page language="VB" %>
> <script runat="server">
> Shared rand As Random = New Random()
> Function GetForecast(zip As String) As String
> Dim ret As String = String.Empty
> Select rand.Next(5)
> Case 0
> ret = "Sunny and warm"
> Case 1
> ret = "Partly cloudy and chilly"
> Case 2
> ret = "Cold with a chance of snow"
> Case 3
> ret = "Rain"
> Case 4
> ret = "Foggy and damp"
> End Select
> Return ret
> End Function
> </script>
> <html>
> <body>
> <h1>My weather forecast page</h1>
> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
> </body>
> </html>
>
> my operating system is Windows XP profesional. I use Internet Information
> Services 5.1 (IIS).
> When I run this page in a webbrowser, the function 'GetForecast' doesn't
> display anything ( no error's). All I see is the HTML text. What can I be
> doing wrong? I got this code from a tutorial.
> Is the code incorrect? Can IIS have incorrect settings?
> Thanks.
>
You need to enclose your frunctions within
Sub
End Sub
statements.
If you want the code to execut automatically
when the page loads, use Sub Page_Load :
<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)
...rest of your code
End Sub
<//script>
best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
> Ok,
> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
> <%@dotnet.itags.org. Page language="VB" %>
> <script runat="server">
> Shared rand As Random = New Random()
> Function GetForecast(zip As String) As String
> Dim ret As String = String.Empty
> Select rand.Next(5)
> Case 0
> ret = "Sunny and warm"
> Case 1
> ret = "Partly cloudy and chilly"
> Case 2
> ret = "Cold with a chance of snow"
> Case 3
> ret = "Rain"
> Case 4
> ret = "Foggy and damp"
> End Select
> Return ret
> End Function
> </script>
> <html>
> <body>
> <h1>My weather forecast page</h1>
> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
> </body>
> </html>
>
> my operating system is Windows XP profesional. I use Internet Information
> Services 5.1 (IIS).
> When I run this page in a webbrowser, the function 'GetForecast' doesn't
> display anything ( no error's). All I see is the HTML text. What can I be
> doing wrong? I got this code from a tutorial.
> Is the code incorrect? Can IIS have incorrect settings?
> Thanks.
You mean something like this, it does not work either:
<html>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Message.Text = "You last accessed this page at: " & DateTime.Now
End Sub
</script>
<body>
<h3><font face="Verdana">Manipulating Server Controls</h3>
This sample demonstrates how to manipulate the <asp:label>
server control within
the Page_Load event to output the current time.
<p>
<hr>
<asp:label id="Message" font-size="24" font-bold="true"
runat=server/>
</body>
</html>
I see the HTML in the browser, but not the Message.Text in the label
control.
"Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> schreef in bericht
news:ew9vH$uKFHA.1948@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> You need to enclose your frunctions within
> Sub
> End Sub
> statements.
> If you want the code to execut automatically
> when the page loads, use Sub Page_Load :
> <script runat="server">
> Sub Page_Load(Src as Object, e As System.EventArgs)
> ...rest of your code
> End Sub
> <//script>
> best,
>
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
> news:Cpidncmdb6Qw76TfRVnyvg@dotnet.itags.org.casema.nl...
>
>
I just pasted your code into
http://asp.net.do/test/vbtest2.aspx
It works fine.
Are you using http://localhost/virtualdirectory/yourfile.aspx ?
Or http://localhost/yourfile.aspx ?
Or http://YourComputerName/virtualdirectory/yourfile.aspx ?
Or http://yourserver.com/directory/yourfile.aspx ?
If you are, and it still doesn't work, try re-registering ASP.NET
from the .NET framework's main directory :
aspnet_regiis -i
( You did install the .NET Framework, right ? )
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
news:CpOdnY2NHqHpHKTfRVnyiw@dotnet.itags.org.casema.nl...
> You mean something like this, it does not work either:
> <html>
> <script language="VB" runat="server">
> Sub Page_Load(Sender As Object, E As EventArgs)
> Message.Text = "You last accessed this page at: " &
> DateTime.Now
> End Sub
> </script>
> <body>
> <h3><font face="Verdana">Manipulating Server Controls</h3>
> This sample demonstrates how to manipulate the <asp:label>
> server control within
> the Page_Load event to output the current time.
> <p>
> <hr>
> <asp:label id="Message" font-size="24" font-bold="true"
> runat=server/>
> </body>
> </html>
>
> I see the HTML in the browser, but not the Message.Text in the label
> control.
>
> "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> schreef in bericht
> news:ew9vH$uKFHA.1948@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>
> If you are, and it still doesn't work, try re-registering ASP.NET
> from the .NET framework's main directory :
> aspnet_regiis -i
It worked....but weird. Someone already installed .NET Framework. Doesn't
make sense ASP.NET needs a seperate installement...I wasn't there when it
was installed on my comp, maybe you can select an option during installation
that you don't want to install ASP.NET.
3 cheers for spain!
Thanks.
> ( You did install the .NET Framework, right ? )
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
> news:CpOdnY2NHqHpHKTfRVnyiw@dotnet.itags.org.casema.nl...
>
re:
> Thanks.
You're very much welcome!
Glad it worked!
re:
> Someone already installed .NET Framework. Doesn't make sense ASP.NET needs
> a seperate installement.
Maybe someone uninstalled/reinstalled IIS ?
That would require re-registering ASP.NET with the new IIS.
re:
> 3 cheers for spain!
Make that the Dominican Republic... ;-)
Happy coding!
Don't let the bug(ger)s get you!
:-)
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Qwert" <nosp@dotnet.itags.org.nosp.com> wrote in message
news:-b6dnYlGzYMPDaTfRVnyiw@dotnet.itags.org.casema.nl...
> It worked....but weird. Someone already installed .NET Framework. Doesn't
> make sense ASP.NET needs a seperate installement...I wasn't there when it
> was installed on my comp, maybe you can select an option during
> installation that you don't want to install ASP.NET.
> 3 cheers for spain!
> Thanks.
>
Wednesday, March 28, 2012
The best way to update a site?
I currently have a site online. I added more features to my datagrid page,
so users can update and stuff. I though I could just copy the aspx, aspx.vb
and the server page including the web config, and paste then on the server.
At c:\intepub\wwwroot\website.
But now I get a runtime error when I go to that page. What is the best way
to update a site after maiking modifications on the developer machine?
TIA
Rudy"Rudy" <Rudy@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:9FB474C1-0B6A-4216-BCD8-5248826FC1EE@dotnet.itags.org.microsoft.com...
> I currently have a site online. I added more features to my datagrid
> page,
> so users can update and stuff. I though I could just copy the aspx,
> aspx.vb
> and the server page including the web config, and paste then on the
> server.
> At c:\intepub\wwwroot\website.
> But now I get a runtime error when I go to that page. What is the best
> way
> to update a site after maiking modifications on the developer machine?
1) What exactly do you mean by "the server page"?
2) Why are you trying to copy the .vb files?
3) Are you using Visual Studio.NET?
Typically, you do not have to move the files containing source code to the
web server (eg .cs, .vb, etc.), you only need to move the content files
(.aspx, .htm, .css, .config, etc.).
When you make updates to the code, you need to rebuild the project and then
copy the content files and the new dll over to the webserver. When you buil
d
the project, your "code files" are compiled into the dll
(yourapp/bin/youapp.dll).
Hope this helps. You may also try google to get a better understanding of
the deployment process and why certain files are needed on the webserver and
others are not.
"Rudy" wrote:
> Hello!
> I currently have a site online. I added more features to my datagrid page
,
> so users can update and stuff. I though I could just copy the aspx, aspx.
vb
> and the server page including the web config, and paste then on the server
.
> At c:\intepub\wwwroot\website.
> But now I get a runtime error when I go to that page. What is the best wa
y
> to update a site after maiking modifications on the developer machine?
> TIA
> Rudy
> But now I get a runtime error when I go to that page. What is the best
way
> to update a site after maiking modifications on the developer machine?
Sounds like you are using VS.net and, as such, you are likely compiling all
your vb pages into a DLL before uploading.
So, if that is the case, you don't want to upload your .vb files, but,
rather, recompile the project, upload your ASPX pages, and then upload your
project's dll file (in the BIN folder).
-Darrel
As a result of what everyone has suggested, please note that re-deploying
your website will cause all session state information to be lost (that is if
you do use In-process state). So, if this is a very busy website, I
wouldn't want to tick your user's off by killing their session information
when you update. So, do you updates at a time when it is not that busy
"Rudy" <Rudy@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:9FB474C1-0B6A-4216-BCD8-5248826FC1EE@dotnet.itags.org.microsoft.com...
> Hello!
> I currently have a site online. I added more features to my datagrid
> page,
> so users can update and stuff. I though I could just copy the aspx,
> aspx.vb
> and the server page including the web config, and paste then on the
> server.
> At c:\intepub\wwwroot\website.
> But now I get a runtime error when I go to that page. What is the best
> way
> to update a site after maiking modifications on the developer machine?
> TIA
> Rudy
Thank you all who replied! I got my site up and running. I forgot about the
dll, and just put the vb files because i thought it couldn't hurt. But is
there harm put those files in, they are not very big.
Anyway, I dumped my entire site and just loaded in a new one. When I moved
the project file from my home to my office developer computer, and named the
project diffrent, off by one letter. So my new project was a little diffrent
then what I had on the server. It's a intranet site, so I just sent a memo
about the new name. Not sure how that happened, but I do remember I had a
heck of a time moving the project over and getting it to work again. Thanks
again!
Rudy
"Tampa.NET Koder" wrote:
> As a result of what everyone has suggested, please note that re-deploying
> your website will cause all session state information to be lost (that is
if
> you do use In-process state). So, if this is a very busy website, I
> wouldn't want to tick your user's off by killing their session information
> when you update. So, do you updates at a time when it is not that busy
> "Rudy" <Rudy@dotnet.itags.org.discussions.microsoft.com> wrote in message
> news:9FB474C1-0B6A-4216-BCD8-5248826FC1EE@dotnet.itags.org.microsoft.com...
>
>
The best way to update a site?
I currently have a site online. I added more features to my datagrid page,
so users can update and stuff. I though I could just copy the aspx, aspx.vb
and the server page including the web config, and paste then on the server.
At c:\intepub\wwwroot\website.
But now I get a runtime error when I go to that page. What is the best way
to update a site after maiking modifications on the developer machine?
TIA
Rudy"Rudy" <Rudy@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:9FB474C1-0B6A-4216-BCD8-5248826FC1EE@dotnet.itags.org.microsoft.com...
> I currently have a site online. I added more features to my datagrid
> page,
> so users can update and stuff. I though I could just copy the aspx,
> aspx.vb
> and the server page including the web config, and paste then on the
> server.
> At c:\intepub\wwwroot\website.
> But now I get a runtime error when I go to that page. What is the best
> way
> to update a site after maiking modifications on the developer machine?
1) What exactly do you mean by "the server page"?
2) Why are you trying to copy the .vb files?
3) Are you using Visual Studio.NET?
Typically, you do not have to move the files containing source code to the
web server (eg .cs, .vb, etc.), you only need to move the content files
(.aspx, .htm, .css, .config, etc.).
When you make updates to the code, you need to rebuild the project and then
copy the content files and the new dll over to the webserver. When you build
the project, your "code files" are compiled into the dll
(yourapp/bin/youapp.dll).
Hope this helps. You may also try google to get a better understanding of
the deployment process and why certain files are needed on the webserver and
others are not.
"Rudy" wrote:
> Hello!
> I currently have a site online. I added more features to my datagrid page,
> so users can update and stuff. I though I could just copy the aspx, aspx.vb
> and the server page including the web config, and paste then on the server.
> At c:\intepub\wwwroot\website.
> But now I get a runtime error when I go to that page. What is the best way
> to update a site after maiking modifications on the developer machine?
> TIA
> Rudy
> But now I get a runtime error when I go to that page. What is the best
way
> to update a site after maiking modifications on the developer machine?
Sounds like you are using VS.net and, as such, you are likely compiling all
your vb pages into a DLL before uploading.
So, if that is the case, you don't want to upload your .vb files, but,
rather, recompile the project, upload your ASPX pages, and then upload your
project's dll file (in the BIN folder).
-Darrel
As a result of what everyone has suggested, please note that re-deploying
your website will cause all session state information to be lost (that is if
you do use In-process state). So, if this is a very busy website, I
wouldn't want to tick your user's off by killing their session information
when you update. So, do you updates at a time when it is not that busy
"Rudy" <Rudy@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:9FB474C1-0B6A-4216-BCD8-5248826FC1EE@dotnet.itags.org.microsoft.com...
> Hello!
> I currently have a site online. I added more features to my datagrid
> page,
> so users can update and stuff. I though I could just copy the aspx,
> aspx.vb
> and the server page including the web config, and paste then on the
> server.
> At c:\intepub\wwwroot\website.
> But now I get a runtime error when I go to that page. What is the best
> way
> to update a site after maiking modifications on the developer machine?
> TIA
> Rudy
Thank you all who replied! I got my site up and running. I forgot about the
dll, and just put the vb files because i thought it couldn't hurt. But is
there harm put those files in, they are not very big.
Anyway, I dumped my entire site and just loaded in a new one. When I moved
the project file from my home to my office developer computer, and named the
project diffrent, off by one letter. So my new project was a little diffrent
then what I had on the server. It's a intranet site, so I just sent a memo
about the new name. Not sure how that happened, but I do remember I had a
heck of a time moving the project over and getting it to work again. Thanks
again!
Rudy
"Tampa.NET Koder" wrote:
> As a result of what everyone has suggested, please note that re-deploying
> your website will cause all session state information to be lost (that is if
> you do use In-process state). So, if this is a very busy website, I
> wouldn't want to tick your user's off by killing their session information
> when you update. So, do you updates at a time when it is not that busy
> "Rudy" <Rudy@dotnet.itags.org.discussions.microsoft.com> wrote in message
> news:9FB474C1-0B6A-4216-BCD8-5248826FC1EE@dotnet.itags.org.microsoft.com...
> > Hello!
> > I currently have a site online. I added more features to my datagrid
> > page,
> > so users can update and stuff. I though I could just copy the aspx,
> > aspx.vb
> > and the server page including the web config, and paste then on the
> > server.
> > At c:\intepub\wwwroot\website.
> > But now I get a runtime error when I go to that page. What is the best
> > way
> > to update a site after maiking modifications on the developer machine?
> > TIA
> > Rudy
>
the brower doesnt compile aspx
thanks in advance,
ling
my practice code is:
---------
<%@dotnet.itags.org. Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="form.aspx" method="post" runat="server">
<asp:textbox id="Name" runat="server" />
<asp:dropdownlist ID="form" runat="server"
<asp:listitem Value="Category" Text="Category" runat="server"></asp:listitem>
<asp:listitem Value="psycchology" runat="server"></asp:listitem>
<asp:listitem Value="popular_comp" runat="server"></asp:listitem>
</asp:dropdownlist
<asp:button ID="Lookup" runat="server" /
</form>
</body>
</html>your browser doesn't compile the code. What are you writting your code in? WebMatrix, Visual Studio,...etc.
Hi,
I've experience the same situation with the following code.
<html>
<head>
</head>
<body>
<form runat=server>
<asp:Label text="Hello World" runat=server />
</form>
</body>
</html
I'm using notepad to write the .aspx file and I've save it to C:\Inetpub\wwwroot. Using the IE6.0 browser and type http://localhost/HelloWorld2.aspx, the resulting page is blank screen.
What seems to be the problem with this? Hope to hear from anybody & thanks.
-Jun
I used visual studio and dreamweaver MX for writing the code and saved it in wwwroot.
thanks in advance,
Make sure aspnet is installed correctly by using the "aspnet_regiis -i" exe that you can find under your framework folder, usually in [system_drive]\[windows]\framework\v1.0.3705 or[system_drive]\[windows]\framework\v1.1.4322 if it's FX1.1
HTH,
Ting-hao
Monday, March 26, 2012
The ConnectionString property has not been initialized
hi
i'm using the register.aspx just to enter data, and i'm not using the code for cookies so my code when preesing register button (note i'm using instead of customer , auther)
Sub Button1_Click(sender As Object, e As EventArgs)
' Only attempt a login if all form fields on the page are valid
If Page.IsValid = True Then
' Add New Customer to CustomerDB database
Dim accountSystem As ASPNET.StarterKit.Commerce.AutherregisterDB = New ASPNET.StarterKit.Commerce.AutherregisterDB()
Dim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)
End If
End Sub
and i'm using same classess and declare connection string in webconfig localhost
but i'm getting the error message after filling the register form textboxes
The ConnectionString property has not been initialized.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.InvalidOperationException: The ConnectionString property has not been initialized.
Source Error:
|
Source File:E:\AbdCommerce\Autherregfrm.aspx Line:17
Stack Trace:
|
thanks
When you use web config to store setting strings, you need to import namespace System.Configuration. Why did you see the error on the codeDim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)?Because the code call a classs that does function to add auther. So, try to go to the class file to add System.Configuration namespace.
Saturday, March 24, 2012
The directive Page is unknown
I am learning ASP.NET
I downloaded source code fromwww.planet-source-code.com
but when I tried to load Default.aspx got this error:
The directive 'Page' is unknown
Here is the first line form my Default.aspx:
<%@dotnet.itags.org. Page language="c#" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" CodeBehind="Default.aspx.cs" %>
What's wrong with "Page" ?
what did you "load" it into ? the syntax looks rightThe element html occurs too few times.
It says "The element 'html' occurs too few times."
Is there anyway to turn off this error to get it to compile?
Richard
"Surely there are other reasons you would want to have an aspx page without an <html> tag in it"
Like when? an aspx page is goign to spit out an HTML document, so the <html> tag makes perfect sense
Sounds like you have your programming all backwards, the aspx page should have the shell and the user controls should have the dynamic content, not the other way around
Like for example when you are trying to output WAP content for one, or plain text for another.
This is because I need to be able to easily substitute the head sections primarily dynamically, this enables multiple sites to run on the same codebase looking for Host headers to load the appropriate templates, it also allows easy support for text only versions of sites, just by dynamically loading text only versions of the user controls, this is for a database driven website content managed system.
Ive looked into master pages but they dont seem to really allow enough flexibility to do what I need to do as they require the definition of the whole document in them, but maybe ill have to work out some way to fudge it with those.
Im not sure what you are refering to about doing it backwards, the aspx page is the shell that loads up the user controls, and the user controls are what contain the dynamic content.
Hello.
Are you also removing the <head> section from the page? I've noticed in the past that if you remove the <html> tag but leave the <head runat="server"> you'll get that errror when you build the project in VS.
one more thing: you can use "filters" to apply different master pages to different browsers. for instance:
<%@.PageLanguage="C#"ie:MasterPageFile="~/Cap14/IE.master"MasterPageFile="~/Cap14/Mozilla.master"%>
applies a master page to IE and another to the other browsers. Check your browsers files to see the IDs of the browsers... oh, and you can alsouse adapters to render your pages/controls according to your needs in different browsers...
I don't think missing <html> element is an error. It is HTML markup validation message and is supposed to be a warning. Does it really break compilation or the page still runs? You can deal with the message in a few ways. First, you can disable validation in Tools | Options | Text Editor | HTML | Validation. Second, you can edit validation schema in Program Files\...\Common7\Packages\schemas\html (IE6_0.xsd, for example) and delete minOccurs="1" maxOccurs="1" from the <xsd:element name="html" >. Third, instead of using ASPX page, you can define your own file type, add it to the web.config and implement a handler for the type that will generate the response programmatically.
Giving it a fuller test it doesnt seem to break compilation on its own, I was getting other compilation errors too which were actually stopping it, but it does get reported as an error rather than a warning along with the other errors leading you to believe it is stopping compilation and needs to be fixed before you can compile.
I say just ignore it. If you are making an XML page, you can't have the <html> tag, for instance. So, just ignore it. That's what I do.
Thursday, March 22, 2012
the explorer window scroll is not kept although smartnavigation=true
<%@dotnet.itags.org. Page language="c#" Codebehind="sap.aspx.cs" AutoEventWireup="false" Inherits="WebForm1" smartNavigation="true"%>
Thankstry setting MaintainScrollPositionOnPostBack = True
sorry i forgot to mention i am using 2003 net 1.1
Thanks
The file '/AHSD/MainMenu.aspx' has not been pre-compiled, and cannot be requested.
pre-compiled, and cannot be requested." when I try to deploy one of my
applications that I am just migrating to VS 2005. I have searched on
the web for a solution, but none of the suggestions so far have
worked. Here is my scenario:
I am using Visual Studio 2005 with SP1 installed and I have created a
Web Deployment Project with the following items selected in the
Property Pages:
compliation tab: just defaults, nothing special selected. Output
folder .\Release\
output assemblies tab: Merge all pages and control outputs to a
single assembly (AssemblyName: AHSD.CompiledApplication)
sigining tab: just defaults
deployment tab: just defaults
I created a virutal directory pointing to the Release folder so that I
could see if it worked and it seems to work perfectly. On our server
there was an existing folder called AHSD that used to contain the
files for the application before it was migrated. I deleted all of
the files and copied the new ones. This is when I get the error.
I have made sure that our Network technician has changed the virtual
directory asp.net tab to use Framework 2.0, I asked him to restart IIS
and I have ensured that the additional assemblies that we reference
within the application have been registered in the GAC.
Any other suggestions?On Oct 3, 11:39 am, lds <lisa.stap...@.gnb.cawrote:
Quote:
Originally Posted by
I am getting the error "The file '/AHSD/MainMenu.aspx' has not been
pre-compiled, and cannot be requested." when I try to deploy one of my
applications that I am just migrating to VS 2005. I have searched on
the web for a solution, but none of the suggestions so far have
worked. Here is my scenario:
>
I am using Visual Studio 2005 with SP1 installed and I have created a
Web Deployment Project with the following items selected in the
Property Pages:
>
compliation tab: just defaults, nothing special selected. Output
folder .\Release\
output assemblies tab: Merge all pages and control outputs to a
single assembly (AssemblyName: AHSD.CompiledApplication)
sigining tab: just defaults
deployment tab: just defaults
>
I created a virutal directory pointing to the Release folder so that I
could see if it worked and it seems to work perfectly. On our server
there was an existing folder called AHSD that used to contain the
files for the application before it was migrated. I deleted all of
the files and copied the new ones. This is when I get the error.
>
I have made sure that our Network technician has changed the virtual
directory asp.net tab to use Framework 2.0, I asked him to restart IIS
and I have ensured that the additional assemblies that we reference
within the application have been registered in the GAC.
>
Any other suggestions?
This afternoon, mysteriously this application started working on our
server. Now for some reason the other apps that are still using the
1.1 version of the framework have stopped working. Any ideas why?
On Oct 3, 3:49 pm, lds <lisa.stap...@.gnb.cawrote:
Quote:
Originally Posted by
On Oct 3, 11:39 am, lds <lisa.stap...@.gnb.cawrote:
>
>
>
>
>
Quote:
Originally Posted by
I am getting the error "The file '/AHSD/MainMenu.aspx' has not been
pre-compiled, and cannot be requested." when I try to deploy one of my
applications that I am just migrating to VS 2005. I have searched on
the web for a solution, but none of the suggestions so far have
worked. Here is my scenario:
>
Quote:
Originally Posted by
I am using Visual Studio 2005 with SP1 installed and I have created a
Web Deployment Project with the following items selected in the
Property Pages:
>
Quote:
Originally Posted by
compliation tab: just defaults, nothing special selected. Output
folder .\Release\
output assemblies tab: Merge all pages and control outputs to a
single assembly (AssemblyName: AHSD.CompiledApplication)
sigining tab: just defaults
deployment tab: just defaults
>
Quote:
Originally Posted by
I created a virutal directory pointing to the Release folder so that I
could see if it worked and it seems to work perfectly. On our server
there was an existing folder called AHSD that used to contain the
files for the application before it was migrated. I deleted all of
the files and copied the new ones. This is when I get the error.
>
Quote:
Originally Posted by
I have made sure that our Network technician has changed the virtual
directory asp.net tab to use Framework 2.0, I asked him to restart IIS
and I have ensured that the additional assemblies that we reference
within the application have been registered in the GAC.
>
Quote:
Originally Posted by
Any other suggestions?
>
This afternoon, mysteriously this application started working on our
server. Now for some reason the other apps that are still using the
1.1 version of the framework have stopped working. Any ideas why?- Hide quoted text -
>
- Show quoted text -
Just incase anyone is wondering...we got this app working. It turned
out that this app was using the same application pool as the 1.1
apps. Once we put it in its own applicaiton pool for 2.0 apps it
worked fine.
The file could not be loaded into the Web Forms designer
install. I am unable to use the web forms designer with any aspx file
whose
form class inherits from a base class. I'm implementing the page
controller
design pattern and everything has been working fine until now. My form
inherits from a base class called CampusNET.CampusPage. The class
exists, is
included in the project and compiles just fine. If I replace the base
class
for my form with the standard System.Web.UI.Page, the designer can open
the
form without any problems, but as soon as I try to inherit from my base
class, it breaks down. I've tried it with an empty base class with only
the
Page_Load method, but the problem remains.
The base class is not abstract so that's not the issue. Neither is the
problem related to the registry entry that leads to the "Illegal
character
in path" error. The full error message looks like this:
"The file could not be loaded into the Web Forms designer. Please
correct
the following error and then try loading it again:
The designer could not be shown for this file because none of the
classes
within can be designed. The designer inspected the following classes in
the
file:
MenuTest -- The base class 'CampusNET.CampusPage' could not be loaded.
Ensure the assembly has been referenced or built if it is part of the
project.
Make sure all of the classes used in the page are build or referenced
in the
project. Click Help for more information."
Has anyone encountered this problem before? I really need to get this
fixed
as soon as possible.
Regards
/CThis is a known issue. I'm pretty certain that it's fixed in VS2005.
I've had something similar with my own base classes... probably a simpler
situation than yours. Mine rears it's head the first time you get the source
code from source control, before you build your project. My project also
contains the base class. It seems as if the designer needs the compiled
version of the base class present - so my fix is to build the project so the
base class gets fixed and all seems to work OK
Hope this helps
Richard MCSD .NET
"crusell@.gmail.com" wrote:
> I'm having some problem with my Visual Studio.NET 2003 (.NET 1.1 SP1)
> install. I am unable to use the web forms designer with any aspx file
> whose
> form class inherits from a base class. I'm implementing the page
> controller
> design pattern and everything has been working fine until now. My form
> inherits from a base class called CampusNET.CampusPage. The class
> exists, is
> included in the project and compiles just fine. If I replace the base
> class
> for my form with the standard System.Web.UI.Page, the designer can open
> the
> form without any problems, but as soon as I try to inherit from my base
> class, it breaks down. I've tried it with an empty base class with only
> the
> Page_Load method, but the problem remains.
> The base class is not abstract so that's not the issue. Neither is the
> problem related to the registry entry that leads to the "Illegal
> character
> in path" error. The full error message looks like this:
> "The file could not be loaded into the Web Forms designer. Please
> correct
> the following error and then try loading it again:
> The designer could not be shown for this file because none of the
> classes
> within can be designed. The designer inspected the following classes in
> the
> file:
> MenuTest -- The base class 'CampusNET.CampusPage' could not be loaded.
> Ensure the assembly has been referenced or built if it is part of the
> project.
> Make sure all of the classes used in the page are build or referenced
> in the
> project. Click Help for more information."
> Has anyone encountered this problem before? I really need to get this
> fixed
> as soon as possible.
> Regards
> /C
>
The file could not be loaded into the Web Forms designer
install. I am unable to use the web forms designer with any aspx file
whose
form class inherits from a base class. I'm implementing the page
controller
design pattern and everything has been working fine until now. My form
inherits from a base class called CampusNET.CampusPage. The class
exists, is
included in the project and compiles just fine. If I replace the base
class
for my form with the standard System.Web.UI.Page, the designer can open
the
form without any problems, but as soon as I try to inherit from my base
class, it breaks down. I've tried it with an empty base class with only
the
Page_Load method, but the problem remains.
The base class is not abstract so that's not the issue. Neither is the
problem related to the registry entry that leads to the "Illegal
character
in path" error. The full error message looks like this:
"The file could not be loaded into the Web Forms designer. Please
correct
the following error and then try loading it again:
The designer could not be shown for this file because none of the
classes
within can be designed. The designer inspected the following classes in
the
file:
MenuTest -- The base class 'CampusNET.CampusPage' could not be loaded.
Ensure the assembly has been referenced or built if it is part of the
project.
Make sure all of the classes used in the page are build or referenced
in the
project. Click Help for more information."
Has anyone encountered this problem before? I really need to get this
fixed
as soon as possible.
Regards
/CThis is a known issue. I'm pretty certain that it's fixed in VS2005.
I've had something similar with my own base classes... probably a simpler
situation than yours. Mine rears it's head the first time you get the sourc
e
code from source control, before you build your project. My project also
contains the base class. It seems as if the designer needs the compiled
version of the base class present - so my fix is to build the project so the
base class gets fixed and all seems to work OK
Hope this helps
Richard MCSD .NET
"crusell@.gmail.com" wrote:
> I'm having some problem with my Visual Studio.NET 2003 (.NET 1.1 SP1)
> install. I am unable to use the web forms designer with any aspx file
> whose
> form class inherits from a base class. I'm implementing the page
> controller
> design pattern and everything has been working fine until now. My form
> inherits from a base class called CampusNET.CampusPage. The class
> exists, is
> included in the project and compiles just fine. If I replace the base
> class
> for my form with the standard System.Web.UI.Page, the designer can open
> the
> form without any problems, but as soon as I try to inherit from my base
> class, it breaks down. I've tried it with an empty base class with only
> the
> Page_Load method, but the problem remains.
> The base class is not abstract so that's not the issue. Neither is the
> problem related to the registry entry that leads to the "Illegal
> character
> in path" error. The full error message looks like this:
> "The file could not be loaded into the Web Forms designer. Please
> correct
> the following error and then try loading it again:
> The designer could not be shown for this file because none of the
> classes
> within can be designed. The designer inspected the following classes in
> the
> file:
> MenuTest -- The base class 'CampusNET.CampusPage' could not be loaded.
> Ensure the assembly has been referenced or built if it is part of the
> project.
> Make sure all of the classes used in the page are build or referenced
> in the
> project. Click Help for more information."
> Has anyone encountered this problem before? I really need to get this
> fixed
> as soon as possible.
> Regards
> /C
>
the file.aspx doesnt work :(
someone know why???
(i already run aspnet_regiis.exe)Go towww.azamsharp.cjb.net
then go to Articles and select DataGrid common operations. I am sure you will find something interesting over there.
im sorry...but i didnt understand how can it help me?
the code is written and working great on another computer-but not on mine...
Are u trying to use edit/delete functionality within a datagrid? can u elaborate on what the problem is?
Edited by SomeNewKid. Please post code between<code> and</code> tags.
this is the code- again:this code working great on another computer-but in my computer the edit/delete/add doesnt work-its only show the recordes from the database-but when i click on one of this command - there is no response...why?
<%@. Page Language="VB" debug=true%>
<%@. Import Namespace="System.Data" %>
<%@. Import Namespace="System.Data.OleDb" %
<script runat="server">
'declare connection
dim Conn as new OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Reality\DATA.mdb")sub Page_Load(obj as Object, e as EventArgs)
if Not Page.IsPostBack then
FillDataGrid()
end if
end subsub Submit(obj as object, e as eventargs)
'insert new data
dim i, j as integer
dim params(1) as string
dim strText as string
dim blnGo as boolean = truej = 0
for i = 0 to AddPanel.Controls.Count - 1
if AddPanel.controls(i).GetType Is GetType(TextBox) then
strText = Ctype(AddPanel.Controls(i), TextBox).Text
if strText <> "" then
params(j) = strText
else
blnGo = false
'lblMessage.Text = lblMessage.Text & "You forgot to enter " & _
' "a value for " & AddPanel.Controls(i).ID & "<p>"
lblMessage.Text = "?? ?? ?"
lblMessage.Style("ForeColor") = "Red"
end if
j = j + 1
end if
nextif not blnGo then
exit sub
end ifdim strSQL as string = "INSERT INTO Cities " & _
"(CityDesc) VALUES (" & _
"'" & params(0) & "')"ExecuteStatement(strSQL)
FillDataGrid()
end sub
sub dgData_Edit(obj as object, e as DataGridCommandEventArgs)
FillDataGrid(e.Item.ItemIndex)
end subsub dgData_Delete(obj as object, e as DataGridCommandEventArgs)
dim num as string=Ctype(e.Item.Cells(0).Controls(1),Label).Text
dim strSQL as string = "DELETE FROM Cities " & _
"WHERE CityId = " & numExecuteStatement(strSQL)
FillDataGrid()
end sub
sub dgData_Update(obj as object, e as DataGridCommandEventArgs)
if UpdateDataStore(e) then
FillDataGrid(-1)
end if
end subsub dgData_Cancel(obj as object, e as DataGridCommandEventArgs)
FillDataGrid(-1)
end subsub dgData_PageIndexChanged(obj as Object, e as DataGridPageChangedEventArgs)
dgData.DataBind()
end subfunction UpdateDataStore(e as DataGridCommandEventArgs) _
as booleandim i,j as integer
dim params(1) as string
dim strText as string
dim blnGo as boolean = truej = 0
' for i = 1 to e.Item.Cells.Count - 2
strText = Ctype(e.Item.Cells(3).Controls(0), TextBox).Text
if strText <> "" then
params(0) = strText
' j = j + 1
else
blnGo = false
'lblMessage.Text = lblMessage.Text & "You forgot to enter " & _
' "a value<p>"
lblMessage.Text = "?? ?? ?"
end if
' nextif not blnGo then
return false
exit function
end ifdim strSQL as string = "UPDATE Cities SET " & _
"CityDesc = '" & params(0) & "'" & _
" WHERE CityID = " & Ctype(e.Item.Cells(0).Controls(1), Label).textExecuteStatement(strSQL)
return blnGo
end functionsub FillDataGrid(Optional EditIndex as integer=-1)
'open connection
dim objCmd as new OleDbCommand _
("SELECT * FROM Cities ORDER BY CityDesc ASC", Conn)
dim objReader as OleDbDataReadertry
objCmd.Connection.Open()
objReader = objCmd.ExecuteReader()
catch ex as Exception
lblMessage.Text = "Error retrieving from the database. Please" & _
" make sure all values are correctly input"
end trydgData.DataSource = objReader
if not EditIndex.Equals(Nothing) then
dgData.EditItemIndex = EditIndex
end ifdgData.DataBind()
objReader.Close
objCmd.Connection.Close()
tbCityName.text=""
lblMessage.Text=""end sub
function ExecuteStatement(strSQL)
dim objCmd as new OleDbCommand(strSQL, Conn)try
objCmd.Connection.Open()
objCmd.ExecuteNonQuery()
catch ex as Exception
lblMessage.Text = "??? ?? ?? ???.? ?? ?? ?? ?? ???"
end tryobjCmd.Connection.Close()
end function
</script
<html>
<head>
<title>??</title>
</head>
<body style="FONT-WEIGHT: normal; FONT-SIZE: small; COLOR: black; FONT-STYLE: normal; FONT-FAMILY: Arial, Aharoni; BACKGROUND-COLOR: #ccccff; FONT-VARIANT: normal"
bgColor="#ffff99">
<DIV align="center">
<font size="4">?? ??</font
<form runat="server" >
<asp:DataGrid id="dgData" runat="server"
BorderColor="black" GridLines="Vertical" align=center
cellpadding="4" cellspacing="0" width="40%"
AutoGenerateColumns="False"
OnDeleteCommand="dgData_Delete"
OnEditCommand="dgData_Edit"
OnCancelCommand="dgData_Cancel"
OnUpdateCommand="dgData_Update"
OnPageIndexChanged="dgData_PageIndexChanged"
<Columns>
<asp:TemplateColumn visible=false>
<ItemTemplate>
<asp:Label id="Name" runat="server" visible=false
Text='<%# Container.DataItem("CityID") %>' />
</ItemTemplate>
</asp:TemplateColumn
<asp:ButtonColumn text="? ???"
CommandName="delete" />
<asp:EditCommandColumn
EditText="...??"
CancelText="?"
UpdateText="??" />
<asp:BoundColumn DataField="CityDesc" /
</Columns>
</asp:DataGrid><p
<asp:Panel id="AddPanel" runat="server">
<table align=center>
<tr>
<td colspan="2" valign="top" align="right">
<asp:Button id="btSubmit" runat="server"
text="??"
OnClick="Submit" />
</td
<td width="100" valign="top">
<asp:TextBox id="tbCityName" runat="server" />
</td>
<td width="50" valign="top">
:?? ?
</td
</tr>
<tr>
<td colspan=4><asp:Label id="lblMessage" runat="server" /></td>
</tr>
</table
</asp:Panel>
</form
</body></html>
please help!!!!!!!!!!1
what could be the problem??
maybe it something to do with properties?because i know that code is working...
Make sure that DataGrid events are attached to the required methods.
Right click on the dataGrid and select the "Lightening Sign" to view all events generated by datagrid and if those all are blank assign them to the appropriate methods.
yes- all DataGrid events are attached to the required methods.
so what could be the problem-maybe permission,IIS?
HI,
In
function ExecuteStatement(strSQL)dim objCmd as new OleDbCommand(strSQL, Conn)
i dont see you specifying CommandType.
Also in FillDataGrid method try to use DataSet instead of DataReader since in Distributing Computing DataSet is more reliable.
About Permission check and see if the user ( which might be ASPUSER ) has permissions to execute delete Queries or not.
In the link below check to see how delete operation is being done:
http://asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=609583
hi,
Add this in ur EditCommandColumn
</code>
<asp:EditCommandColumn ButtonType="LinkButton" ></asp:EditCommandColumn> </code
and see whether the edit link button have something changed.
if this work, ur update command will still cant work.
Solve it one by one
Cheers
life's Ng
hi-life's Ng ...
well its still dont work...do u think the problem its in the code?maybe something else?
Thanks
Super weird... For me, the below code enable me to at least see the changes(Cancel And Update text come up)...
sub dgData_Edit (Sender as object,e as DataGridCommandEventArgs)
FillDataGrid(e.Item.ItemIndex)
end sub<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" HeaderText="EDIT" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
ur case.... Mind if u try The code above? Sorry cant help u much.
Where did u get this codes from? Sams Teach yourself in 21 days? if u can get this book, i believe it helps alot for u to understand the codes.
I was tried this before and it's worked.(actually, after 1week+ of strugle to get it work)
If u want my full codes for reference, kindly let me know.
Cheers
life's Ng
Sorry, left out the filldatagrid event
sub FillDataGrid(Optional EditIndex as integer=-1)
dim dbtxt as string="OnShow"
dim objCmd as new OleDbCommand("select * from Personnel Where DbShow= '" & dbtxt &"' ", Conn)
dim objReader as OleDbDataReadertry
objCmd.Connection.Open()
objReader= objCmd.ExecuteReader()
catch ex as Exception
lblmessage.Text=" error retrieving from database."
end trydgData.DataSource=objReader
if not EditIndex.Equals(Nothing) then
dgData.EditItemIndex = EditIndex
end ifdgData.DataBind()
objReader.Close
objCmd.Connection.Close()
end sub
hi-
well i tried all this options-but no change!!!!:((((
i really dont know what to do-part of this code is from asp.net Chris Payne.
i still think that the problem is not in the code..:((((((((((((((((((
where i can i see this permissions?in the wwwrot properties?
THE FULL CLASS
hello, i'm kinda new to ASP.NET and web development
i've read that when i write behind-code for an .aspx file it's just a partial class
is there a way to read the content of the other partial class that contains the components' declarations?
Hey,
That part of the component is generated in your Temporary ASP.NET Files (under the windows\framework\<version>) folder for your application, which is where your ASP.NET pages are compiled. This was a feature meant to make it less of a coding effort. You can still access the objects in your code-behind page without those declarations.
I don't know if the web application project template does this or still includes the controls as in 1.1...
Tuesday, March 13, 2012
the http reponse to file? ASP.NET 2.0
It is a ASP.NET aspx file created partly from GET parameters, but most often
using the ASP.NET event model (i.e. clicking buttons etc).
One of the buttons is called "Generate a pdf document of the current page"
and it clicking it should create a pdf document on the server side and
returning the pdf to the user.
To my aid I have a server side component that can convert a file or the html
content of a URL to a pdf document. So if I somehow can generate the
information of the current aspx page to file, I can convert it to pdf and
change the Response.ContentType to "application/pdf".
But the question is how to generate the file that I want to convert. If I
send the current URL to the pdf component, it will point to the page and how
it looks when no interaction has been done. What I really want is the page
after all clicks, i.e. how it looks "right now".
Any ideas? Thank you,
/FredrikThus wrote Fredrik,
> I want to generate a pdf file of "the current page".
> It is a ASP.NET aspx file created partly from GET parameters, but most
> often using the ASP.NET event model (i.e. clicking buttons etc).
> One of the buttons is called "Generate a pdf document of the current
> page" and it clicking it should create a pdf document on the server
> side and returning the pdf to the user.
> To my aid I have a server side component that can convert a file or
> the html content of a URL to a pdf document. So if I somehow can
> generate the information of the current aspx page to file, I can
> convert it to pdf and change the Response.ContentType to
> "application/pdf".
> But the question is how to generate the file that I want to convert.
> If I send the current URL to the pdf component, it will point to the
> page and how it looks when no interaction has been done. What I really
> want is the page after all clicks, i.e. how it looks "right now".
> Any ideas? Thank you,
HttpResponse allows you set another stream as a filter using HttpResponse.Fi
lter.
You could use that to write the response to a temporary file, create the
PDF, and write the PDF back to the actual response stream.
Cheers,
--
Joerg Jooss
news-reply@.joergjooss.de
Very interesting!
It seems the file isn't created until the Response ends. This seems natural
to me when thinking about it.
But when the response has ended, I per definition have lost my chance to
alter the response (remeber, I wamt to send the pdf instead). I guess I will
have to trigger another request somehow, and in the new Response show the pd
f.
Havn't still figured out the last details yet. Thanks, anyhow, for your kind
help.
Regards
/Fredrik
"Joerg Jooss" wrote:
> Thus wrote Fredrik,
>
> HttpResponse allows you set another stream as a filter using HttpResponse.
Filter.
> You could use that to write the response to a temporary file, create the
> PDF, and write the PDF back to the actual response stream.
> Cheers,
> --
> Joerg Jooss
> news-reply@.joergjooss.de
>
>
Thus wrote Fredrik,
> Very interesting!
> It seems the file isn't created until the Response ends. This seems
> natural to me when thinking about it.
Are you sure you just don't need a Response.Flush()?
Cheers,
--
Joerg Jooss
news-reply@.joergjooss.de
the http reponse to file? ASP.NET 2.0
It is a ASP.NET aspx file created partly from GET parameters, but most often
using the ASP.NET event model (i.e. clicking buttons etc).
One of the buttons is called "Generate a pdf document of the current page"
and it clicking it should create a pdf document on the server side and
returning the pdf to the user.
To my aid I have a server side component that can convert a file or the html
content of a URL to a pdf document. So if I somehow can generate the
information of the current aspx page to file, I can convert it to pdf and
change the Response.ContentType to "application/pdf".
But the question is how to generate the file that I want to convert. If I
send the current URL to the pdf component, it will point to the page and how
it looks when no interaction has been done. What I really want is the page
after all clicks, i.e. how it looks "right now".
Any ideas? Thank you,
--
/FredrikThus wrote Fredrik,
> I want to generate a pdf file of "the current page".
> It is a ASP.NET aspx file created partly from GET parameters, but most
> often using the ASP.NET event model (i.e. clicking buttons etc).
> One of the buttons is called "Generate a pdf document of the current
> page" and it clicking it should create a pdf document on the server
> side and returning the pdf to the user.
> To my aid I have a server side component that can convert a file or
> the html content of a URL to a pdf document. So if I somehow can
> generate the information of the current aspx page to file, I can
> convert it to pdf and change the Response.ContentType to
> "application/pdf".
> But the question is how to generate the file that I want to convert.
> If I send the current URL to the pdf component, it will point to the
> page and how it looks when no interaction has been done. What I really
> want is the page after all clicks, i.e. how it looks "right now".
> Any ideas? Thank you,
HttpResponse allows you set another stream as a filter using HttpResponse.Filter.
You could use that to write the response to a temporary file, create the
PDF, and write the PDF back to the actual response stream.
Cheers,
--
Joerg Jooss
news-reply@.joergjooss.de
Very interesting!
It seems the file isn't created until the Response ends. This seems natural
to me when thinking about it.
But when the response has ended, I per definition have lost my chance to
alter the response (remeber, I wamt to send the pdf instead). I guess I will
have to trigger another request somehow, and in the new Response show the pdf.
Havn't still figured out the last details yet. Thanks, anyhow, for your kind
help.
Regards
--
/Fredrik
"Joerg Jooss" wrote:
> Thus wrote Fredrik,
> > I want to generate a pdf file of "the current page".
> > It is a ASP.NET aspx file created partly from GET parameters, but most
> > often using the ASP.NET event model (i.e. clicking buttons etc).
> > One of the buttons is called "Generate a pdf document of the current
> > page" and it clicking it should create a pdf document on the server
> > side and returning the pdf to the user.
> > To my aid I have a server side component that can convert a file or
> > the html content of a URL to a pdf document. So if I somehow can
> > generate the information of the current aspx page to file, I can
> > convert it to pdf and change the Response.ContentType to
> > "application/pdf".
> > But the question is how to generate the file that I want to convert.
> > If I send the current URL to the pdf component, it will point to the
> > page and how it looks when no interaction has been done. What I really
> > want is the page after all clicks, i.e. how it looks "right now".
> > Any ideas? Thank you,
> HttpResponse allows you set another stream as a filter using HttpResponse.Filter.
> You could use that to write the response to a temporary file, create the
> PDF, and write the PDF back to the actual response stream.
> Cheers,
> --
> Joerg Jooss
> news-reply@.joergjooss.de
>
Thus wrote Fredrik,
> Very interesting!
> It seems the file isn't created until the Response ends. This seems
> natural to me when thinking about it.
Are you sure you just don't need a Response.Flush()?
Cheers,
--
Joerg Jooss
news-reply@.joergjooss.de
The image cannot be displayed, because it contains errors.
I have a code in photo.aspx.cs as follows to display image in browser (photo.aspx does not have any space or markup, only @dotnet.itags.org. Page directive):
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "image/bmp";
string employeeID = Request.QueryString["EmployeeID"];
string sqlText = "SELECT Photo FROM Employees WHERE EmployeeID = " + employeeID;
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ToString());
SqlCommand command = new SqlCommand(sqlText, connection);
connection.Open();
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
Response.BinaryWrite((byte[])dr["Photo"]);
}
connection.Close();
Response.Flush();
Response.Close();
}
Now when I access this page as http://localhost:4538/WebSite12/photo.aspx?EmployeeID=1 in firefox, it gives following error. Can someone help me to sort out this problem please?
The image "http://localhost:4538/WebSite12/photo.aspx?EmployeeID=1" cannot be displayed, because it contains errors.
Hi,
How about this one, which is from http://davidhayden.com/blog/dave/archive/2006/07/25/SavingDisplayingPhotosInSQLServerUsingASPNET.aspx
protectedvoid Page_Init(object sender, EventArgs e){if (Request.QueryString["id"]!=null) {int id;if (Int32.TryParse(Request.QueryString["id"],out id)) { Response.Clear(); Response.ContentType="image/jpeg"; Image image= RetrieveImage(id); image.Save(Response.OutputStream, ImageFormat.Jpeg); } }}private Image RetrieveImage(int photoId){ Image image=null;using (SqlConnection connection=new SqlConnection("...")) {using (SqlCommand command= connection.CreateCommand()) { command.CommandText="SELECT Photo FROM Photos
WHERE PhotoId = @.PhotoId"; command.Parameters.AddWithValue("@.PhotoId", photoId); connection.Open();byte[] imageData= (byte[])command.ExecuteScalar(); MemoryStream memStream=new MemoryStream(imageData); image= Image.FromStream(memStream); } }return image;}The language behind www.microsoft.com
extension, but it does not look like ASP.NET webpage. It does not have
__VIEWSTATE, it doesn't have <form> in the body... Just tones of
JavaScript.
Anyone any idea what is the language behind it?BTW it is the same with MSN.com. It is even XHTML Strict, which is
strange for Microsoft...
On 20 Mar 2007 11:35:25 -0700, georgi.ivanov@.gmail.com wrote:
> The index http://www.microsoft.com/en/us/default.aspx has .aspx
> extension, but it does not look like ASP.NET webpage. It does not have
> __VIEWSTATE, it doesn't have <form> in the body... Just tones of
> JavaScript.
> Anyone any idea what is the language behind it?
The aspx extension does not necessarily mean asp.net. For all we know they
may be using ruby on rails but mapped the .aspx extension to ruby!!! :)
--
Bits.Bytes
http://bytes.thinkersroom.com
On Mar 20, 7:35 pm, "georgi.iva...@.gmail.com"
<georgi.iva...@.gmail.com> wrote:
> The indexhttp://www.microsoft.com/en/us/default.aspxhas .aspx
> extension, but it does not look like ASP.NET webpage. It does not have
> __VIEWSTATE, it doesn't have <form> in the body... Just tones of
> JavaScript.
> Anyone any idea what is the language behind it?
it's not a language, it's Microsoft Office SharePoint Server 2007