using html source instead of actual aspx page - c#

Somehow i have lost my source code but i have published project in precompile state on my hosted server. i am able to recover c# code using decompilers but unable to find the aspx pages code as they are in compiled form. when i view them in decompiler they just show me the C# code of aspx page which is not helping me.
Initially i decided to reconstruct them on the basis of GUI but its taking too much time. My questions is , is this possible i can use the html source of page instead of its actual aspx code ? i have the c# code for my page but no aspx code so if its possible just to copy the html in aspx file and try to run if this works?

Related

Parse Error While Opening a dynamic Page

This is my first post here. I am doing a college project and I am stuck in an error.
I am building an e-learning website in ASP.net and they are static pages. Now, when I am opening a contact-us form it is throwing me an error.
Error Page
Contact us form is in another folder.
Link page
I am a noob :( Please explain me in easy way.
enter code hereThe error you are getting means that there is no file called default.aspx.cs in the same directory as your default.aspx file.
Please make sure that this file exists.
You may have deleted it, or moved it to a different location.
Your IIS is trying to link the default.aspx.cs, which is the code file, to the default.aspx file, which is your HTML file, which uses the code.
You can see the link between the files at the top level declarations in your ASPX file:
"Codefile = default.aspx.cs"
If you cannot file the default.aspx.cs file, I suggest you re-create the ASPX file using your development editor. This will create the default.aspx.cs file automatically under your ASPX file.
From MSDN:
The code-behind page model for Web Forms allows you to keep the markup
in one file—the .aspx file—and the programming code in another file.
The name of the code file varies according to what programming
language you are using. For example, if you are working with a page
named SamplePage, the markup is in the file SamplePage.aspx and the
code is in a file named SamplePage.aspx.vb (for Visual Basic) and
SamplePage.aspx.cs (for C#).
Hope this helps.
Well! The issues was I didn't selected the C# and my project was on vb. This is the reason why it thrown me that error.
If this error comes we need to make sure what files we are having and in which language we are making project :)

Can people find and download the Code File linked to your aspx page?

So I imported this aspx page done by a former dev who worked for the company I'm in now. I found that the aspx page left by him doesn't have a codebehind file so I assumed this wasn't the source code. I can't find the source so I added a code file and try to work it out on my own. But my main concern is this: clients can't access the code behind, right? Is a manually added code file subject to the same protection?
The codebehind file is there as a place to put your server side code. However it's technically not necessary to have one since you can put the code in the aspx file using c# script tags. It's however recommended to put it in the codebehind file for better separation between markup and code.
It does not matter if you add it yourself or if Visual Studio adds it for you. It does not change anything in terms of access. In all events it executes on the server.
If your server is properly configured to run ASP.NET applications - which I believe it is - then IIS will not serve .cs files to a client. These will normally be accessible only through FTP. Try it yourself, by browsing to any .cs file in your application :)
Also notice that what you get when you browse to an .aspx file is not the very same code you'd see in Visual Studio, but the result of that being processed. IIS will serve the resulting HTML. So even if you have server side code in the ASPX file, that won't be visible to an end user browsing through your application.
Sounds like a web application project; in this case, the code is in the code-behind file as #TGH mentioned, and the code would be in the DLL compiled for the web application. Therefore, the only way to get that code is use a tool like Telerik JustDecompile, and decompile that DLL to grab the source code for EVERY file in the project. It would be much better to have the source, as these decompile tools do not include everything in that code-behind file.

Execute C# code while using .load jquery

Again, I've looked around to try to find some posts on this and there are many but none that address my specific question (that I could find).
What I am looking : I have a projects and it loads different pages (.aspx) in an iframe dynamically. Now I am trying to remove iframe and add a div and load aspx pages inside that div, using this :
$("#containerDiv").load("test/default.aspx", function () {
});
it loads aspx page easily but I am unable to execute C# code which is written in default.aspx.cs may be its not a good practice but I want to know is there any solution of my problem.
$.load will not your c# code why because it load only the contents of your aspx page not of aspx.cs.
Use user controls instead.
If need help how to implement user control refer this link.

Run a aspx page into a Sharepoint folder

I have a aspx page and I'd like to run it into a sharepoint folder. Is there a way to execute this page like a html page? What I really need is to run a c# code that is together the aspx page (code behind) to read a SQLite database and shows the result in a good interface (html-css-javascript).
Obs.: I have a assembly reference for the SQLite.
Thanks a lot!
You need to create an application page inside sharepoint and move your code in that application page. its very simple, please see this link.
http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-create-custom-sharepoint-2010-application-page-using-visual-studio-2010/
Please note that application page only support web forms and not MVC
Not sure "run it into a sharepoint folder" means... You can't have page with code behind in regular SharePoint folders.
You can put ASPX pages (even with codebehind) in Layouts folder on server's disk and they will be avaiable with ....\layouts\your_page.aspx urls.

Using Admin Panel How we can create a aspx page in sitefinity?

how we can create the dynamic page ex. help.aspx and write the code in sitefinity. Because i facing a problem I create a page but i unable to know in which directory the page is lived. If any one help me Suggest.
http://abc.com/sitefinity/admin/pages.aspx
I'm not exactly sure I understand your question correctly. When you create a page in Sitefinity, it doesn't create an ASPX file. The data for the page is kept in the database and served from there. There are no physical files involved.
If you want to write some code that executes when a page loads, you have two options:
Put the code into a control and drop the control on a page created from within Sitefinity
Create a regular ASPX page from Visual Studio and include it as an external page in Sitefinity.
I would recommend the first option, as this would provide you with all the Sitefinity goodness that all pages use - templates, editing through the browser, etc.
If you wanted something else and I misunderstood, please be more specific.
Slavo, The Sitefinity Team

Categories