473,416 Members | 1,774 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,416 software developers and data experts.

Running code when viewing aspx code

Hi guys,

Our team has a very strange problem. I hope anybody can help.

We have a class called webpage and all our aspx-pages bases on it. Then we
have a SYS.IO.File Class which have a function. This function checks the hash
value of some ini-files. If the hash value is not valid then the function
throws an error.
Imagine we are editing the code behind file of an aspx-page. If we now want
to view the aspx-code we double click the aspx-file in the project explorer
and then there occurs the exception of the function in the class SYS.IO.File.
The application is not running.
We don't have any idea why the webpage is calling the function in this moment.
Is there any possible reason why code is running when viewing the aspx-code
while the web-application is not running?
Nov 19 '05 #1
2 1949
Assuming that you are working with VS.NET

If you open any aspx file in VS.NET by double clicking in Solution Explorer,
VS will open
that page in design mode, As per my understanding the design view is nothing
but
like a web browser, so it executes the code there and shows the error.

I too have faced some strange errors when opening a aspx page in design view
you can change this options in tools>options window to open any aspx page
in html view.

Have a try, as i'm not sure about this answer.
Atleast it will help you in going closer towards the problem.

--
Vadivel Kumar
http:\\charpblogs.blogspot.com

"Matthias H." <Ma*******@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
Hi guys,

Our team has a very strange problem. I hope anybody can help.

We have a class called webpage and all our aspx-pages bases on it. Then we
have a SYS.IO.File Class which have a function. This function checks the
hash
value of some ini-files. If the hash value is not valid then the function
throws an error.
Imagine we are editing the code behind file of an aspx-page. If we now
want
to view the aspx-code we double click the aspx-file in the project
explorer
and then there occurs the exception of the function in the class
SYS.IO.File.
The application is not running.
We don't have any idea why the webpage is calling the function in this
moment.
Is there any possible reason why code is running when viewing the
aspx-code
while the web-application is not running?

Nov 19 '05 #2
Hi Matthias,

the reason why your code is executed is that VS.NET calls OnInit method of
the page (but not only, also code in properties is executed...), when you
try to open the aspx in Desing Mode.

There is a workaround.

You need to put your code inside this IF:
if (Site == null || !Site.DesignMode)
{
// this is the normal situation
}
else
{
// this is the VS.NET DesingMode situation
}

HTH

Bye,
Stefano
"Matthias H." <Ma*******@discussions.microsoft.com> ha scritto nel messaggio
news:25**********************************@microsof t.com...
Hi guys,

Our team has a very strange problem. I hope anybody can help.

We have a class called webpage and all our aspx-pages bases on it. Then we
have a SYS.IO.File Class which have a function. This function checks the hash value of some ini-files. If the hash value is not valid then the function
throws an error.
Imagine we are editing the code behind file of an aspx-page. If we now want to view the aspx-code we double click the aspx-file in the project explorer and then there occurs the exception of the function in the class SYS.IO.File. The application is not running.
We don't have any idea why the webpage is calling the function in this moment. Is there any possible reason why code is running when viewing the aspx-code while the web-application is not running?

Nov 19 '05 #3

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

Similar topics

2
by: Mark | last post by:
Hi, I recently had to install IIS onto my machine. With the webserver started (On the local machine) I went to view an ASP.net application that I had previously written. When I go to view the app...
1
by: Nikhil Patel | last post by:
Hi all, I have created a web application on windows xp/visual studio 2003. I am trying to test this application on my development machine. When I type the following url to run my app in internet...
2
by: crjunk | last post by:
I'm having problems viewing ASPX pages in the VS.NET browser. For some unknown reason, it just stooped working. The status bar at the bottom just says "Downloading...". So far I haven't been...
1
by: dk | last post by:
Any idea why the response time is slow when running a system tray app when viewing the properties form? There is one primary loop and a timer control which executes every 3minutes. Is having the...
1
by: QLD_AU | last post by:
I am having trouble when viewing the code behind a form, any events i do are shown, however the Windows Form Designer generated code Section is not shown, Does anyone know how to turn this on...
0
by: Stimp | last post by:
I've created an aspx page called HistoryManage.aspx. The page works fine on my local machine but when I load it off the web I get the following strange error... Compilation Error...
0
by: Jeremy | last post by:
If I create a folder in outlook and give it a homepage url to an ajax asp.net page I've developed, I get ajax errors on my page when viewed in outlook. If I click on a button in an update panel...
3
by: =?Utf-8?B?TG9nZ2Vy?= | last post by:
Help, I’m applying updates to a web application that used Web Form Designer Generated Code. I’m using Visual Studio 2003. For some reason lines keep dropping out of the code in the .aspx.vb...
3
by: noureddine | last post by:
When I create a folder in outlook and give it a homepage url to an ajax asp.net page I've developed, I get ajax errors on my page when viewed in outlook. The Error is : "Access is denied". I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...

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.