473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

A problem with Single-File ASPXs

I've been using my installed VS 2005 for several months with no problem.
Suddenly, something strange is happeneing and I'm not sure if it's something
I'm missing in ASP.NET or something that's gotten messed up in VS.

If I create a completely new Web Site Project in a blank directory with
nothing in it, VS automatically creates a single Default.aspx with a
code-behind page. If I go in and edite the Code-Behind and insert something
like a Response.Write(), all goes well.

But if I try to create a new ASPX file and I uncheck the "Place code in a
separate file" checkbox, and then I try to place that same Response.Write()
in a server-side script block in the actual ASPX file, I get weird parsing
errors and t=the pop-down intellisense feature doesn't even show the Response
object as being available in scope. How is this possible? What's wrong with
my extremely simple stand-alone ASPX file?

Below is the full text of this extremely short file and would love it if
someone could tell me what could possibly be wrong with it! I've even
manually placed a bunch of <%@ Import Namespace=...%> things in there but
that doesn't seem to fix the problem!

Default.aspx...
--------------------------------------------------
<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.WebControls.WebParts" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script language="C#" runat="server">
Response.Write("???");
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

--------------------------------------------------
May 7 '06 #1
1 1440
Hi,

Thanks for your posting.

In Single-File Page Model, the script block can contain as much code as the
page requires. The code can consist of event handlers for controls on the
page, methods, properties, and any other code that you would normally use
in a class file. At run time, a single-file page is treated as a class that
derives from the Page class. The page does not contain an explicit class
declaration. Instead, the compiler generates a new class that contains the
controls as members.

As in your sample code, you might need to wrap the "Response.Write ..."
code in a method.

If there is anything unclear, please feel free to post here.

Regards,

Walter Wang
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

May 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Hugo Coolens | last post by:
I need to use the str_replace function for a php-script which works together with html/javascript. In the script I have to perform things like: $arabic=str_replace ("'","\'", $row);...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
5
by: C. Alexander | last post by:
I'm trying to create a multi-user interactive whiteboard that has the ability to load a 'background' image to draw ontop of. The client/server needs to load a transparent layer for each user...
3
by: Steen Gellett | last post by:
Hey...........is it possible to move a picture around the form with the mouse ? I have a form with one picture on it........when I hold down the mouse I would like the picture to follow the...
1
by: Steve | last post by:
Hi; I have a table with a TEXT datatype. Its a comment field. Right now the users who put in singlequotes are killing the web front end. The programmer responsible is fixing this issue but...
3
by: Stefania Scott | last post by:
How do I resolve the problem of passing a string that has quotes within in a SQL statement? Sometimes the string contains a single quote (') and some others it contains the double quote (")? Any...
0
by: JL_327 | last post by:
No one on any of the other boards seem to know In VB.Net this late binding works fine Dim Version As Integer Dim Revision As Integer Dim Wnum As Integer Dim o As System.Array =...
17
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions...
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
11
by: Elmo | last post by:
Hi all! I am not very proud to ask this but here is my problem: string code = "\'13\'" The string code will have to contain following info: '51','52','63','other'... to get certain info...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.