How to get the source code of a aspx page - c#

I want to get the main source of an aspx page.
How can i be able to know as to which and all links been created to get that site. When I right-click on the page, I get some Html page...but cant use it for compilation. Is ther some other way to approach this.?
Help me out as i'm new to asp.net 4.0.
and yea, 1 more thing, I just need to get the UI design tags which produced the page.
Thanks in advance...

You can't do it... Unless you are local on the same machine OR Have ftp access onto the server. OR when IIS is not configured to server asp.net application.

Unless you have access to the server where the files are hosted you cannot see the source code.
ASP.NET is server side, so when you request the page the web server (IIS) will use the ASP.NET engine to do the processing on the server and then construct the HTML, which is the output you see in the browser.

Related

Easy way to redirect page when site not available?

We have a regular asp.net website. I started debugging several errors, so the website cannot be used (but is not down). Since the default page is not Default.aspx and users are used to going directly to Main.aspx, if anyone goes to http://network:1332/Main.aspx, the person should be redirected to Issues.htm.
Is there an easy to do this without having to alter Main.aspx or write any code? Maybe change web.config or some IIS 6 configuration?
I just don't want anyone to use the website even though the site is available for use.
Thanks.
If you have an ASP.NET web application site, and you place a text file
named "app_offline.htm" in the root of the site, all requests to that
website will redirect to that app_offline.htm file. Basically, if you
need to take an entire ASP.NET site offline, you can place some nice
message in that file.
https://forums.iis.net/t/1152788.aspx?Put+website+in+maintenance+mode
Be warned you too will be directed to the maintenance page, so if you're debugging in production this could make things more difficult.
You can use Url Rewrite Module to IIS. Then you will be able to define your rewrite rules in web.config or using IIS Manager. Check this : https://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

C# .net Offline page?

So I have here a .NET C# web app that needs one page able to be viewed offline as a user could be off in the middle of 'whoop whoop' with no internet.
The order of events are:
User visits a form online
Store the webpage using HTML5 so they can visit it later offline
When online - the user then can submit the form to the database
I've been looking over HTML5 appcache however it seems to only reference physical .html or .php pages rather than storing pages which have been generated by 'Razor' .cshtml Views.
e.g. domain.com/path/view.
I haven't been able to find any relevant documentation for my problem either.
So is it possible to cache a .NET webapp ofline?
Although I have not tried it, and assuming your app uses ASP.NET MVC, this might help you:
Build an HTML5 Offline Application with Application Cache, Web Storage and ASP.NET MVC
It uses HTML5 Offline Web Application API (or HTML Application Cache). Note the comment on browser support.
The linked article shows a sample application, but I could not see a link to a downloadable source code. But one commenter appears to have recreated the project.
The appcache is what you need. Note that you specify the pages to be cached, but the browser never sees if the page is a static .html or generated via Razor. As long as the path you specify opens the right page, it will be cached.

Using Webform page in Classic ASP website

I am updating some functionality in a classic asp website and basically to make populating a drop down happen after a value is selected in another drop down I am trying to change that page for a webform page with code behind. However, for some reason I just get the following message when attempting to go to that page:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Is it possible to have the webform in this site? Is the issue something to do with IIS or caching? I don't actually have access to the server to refresh the IIS or anything so some clues about what could be happening would be useful before I go any further.
Thanks.
I just talked to someone about this and it is possible to run a webforms page in a classic asp site but the site I am working on uses a lot of session variables which are not transferred between the asp and aspx pages so it is not going to be a viable option anyway. I am going to use ajax to populate the select list.
Thanks.

How to access clipboard image and save it at server location in asp.net web application?

I wish to have the following feature in my web application:
On the client side When I copy an image from anywhere (it gets loaded to the clipboard), now I wish to have a button on which when I click it should save the image at the server location at some path.
I am ok to use anything javascript, jquery, c# at server side code just need the implementation of the above feature.
Please help.
Thanks a lot in advance.
Vaibhav
Check out this question and answers to it: How does the paste image from clipboard functionality work in Gmail and Google Chrome 12+? .
I think the most difficult part is to get it working in all browsers. So if you need older browsers support you probably should use some flash solution like http://code.google.com/p/zeroclipboard/ .
To save it to server you need some controller's POST action (if using MVC) or webservice or aspx page if using webforms. After getting clipboard image with javascript you send it to the server using AJAX for example.

Best way to get copy of remote XML?

I need access to a couple of XML files on a remote server. Because of the crossdoamin policies, i cannot do it with jQuery alone, but need a small c# .aspx page, which will act as a gateway for my jQuery to fetch the remote xml from a local file. But how would i best go about this page - what is the simplest structure of such a file?
You could use a "Generic Handler" (ASHX file).
I'll use these kind of files often when sending files to the browser, without the need for an UI (i.e. no visible page content).
In my understanding I see ASHX handlers as "pages without an UI" that have low overhead compared to a normal Page.
Why not a web service?
client code (jQuery) -> your server (WCF) -> external xml
You can quickly create a REST web service with this template.

Categories

Resources