473,791 Members | 2,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Syst em" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Configuratio n" %>
<%@ Import Namespace="Syst em.Collections" %>
<%@ Import Namespace="Syst em.Web" %>
<%@ Import Namespace="Syst em.Web.Security " %>
<%@ Import Namespace="Syst em.Web.UI" %>
<%@ Import Namespace="Syst em.Web.UI.WebCo ntrols" %>
<%@ Import Namespace="Syst em.Web.UI.WebCo ntrols.WebParts " %>
<%@ Import Namespace="Syst em.Web.UI.HtmlC ontrols" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

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

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

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

--------------------------------------------------
May 7 '06 #1
1 1464
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.W rite ..."
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
21585
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); $arabic=str_replace ("sh", "\š", $row); the second line works perfectly, however I can't make the first one work, it should replace a single quote with a quote preceded by a backslash. I presume I have to escape some characters to make this happen however...
11
36178
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 a javascript function called by onClick. The problem is that the text may contain single or double quotes, which screws up the javascript. I eliminated the single quote problem by running the text through addslashes, but the double quotes are a...
5
11537
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 that connects. This is so the individual user layers can be cleared. Each layer is painted on by the user it is assigned to, so the layer must respond to mouse events.
3
13416
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 mouse until mouse is released and then place the picture there.........can anyone tell me how with a short code example ??
1
11885
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 it might be a few weeks until we get the patch.
3
3171
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 clue... Thank you, Stefania
0
1527
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 = System.Array.CreateInstance (GetType(Single), 1)
17
2794
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 might be a neat way to solve this, but I am new to them. Can anyone give me a hint here? The catch is, it must only find tokens that are not quoted and not commented; examples follow
14
3275
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 make things simpler and better readable I'd make all default parameters named parameters so that you can decide for yourself which one to pass and which not, rather than relying on massively overlaoded methods which hopefully provide the best...
11
1870
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 from the database. When the querry is parsed these values will be looked up:
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.