beginners query about asp.net website management - asp.net

I recently started managing a asp.net website. earlier my employee had simple HTML and one php website and I can easily work with both of them and can do medium level of customization like add/edit things. But now i have asp.net website and its killing me.
All the files are precompiled but I have source code. Please tell me how to add edit content etc. Consider me as a student with required knowledge of HTML, php and css.
For example I was told to add a table in a page, I had html code for same but did not know how to do it. I tried adding it in HTML file and aspx file but no use. Than I add it in files in bin folder and website started giving error about precompile index file first.
Now when you know my understanding about asp.net is nil, please, guide me to save myself from embarrassment I may face. Although its not my job M into marketing but during interview I said that I can do it all w/o knowing they have asp.net for me. Also let me know the tools I require like visual studio, iis etc.

This is why ASP.NET works best for complicated websites with a well-defined build/deploy process and not simple websites that need updating regularly.
You should be able to add and edit static content in the *.master, *.aspx and *.ascx files without any problems - the ASP.NET runtime will recompile those files on the server, so there is no need for the source files - unless the website was compiled with "stub" *.aspx files (that's when the files have a single line that looks like <%# Page Inherits="MyAssembly.SomePage" %>).
You said you tried this already, but that it was of "no use". Can you explain what happened afterwards? Did you get any error messages?
The bin folder is where you put the DLL files from the project after it has been built (the build process includes compilation). Can you please show us the entire "precompile index file first" error message you received? The descriptions you've given us are too vague to help you with.
If your ASP.NET site does not have any custom logic beyond a simple "Contact Us" email form, then I strongly suggest you convert it back to a static HTML or PHP website, if only to save everyone's sanity.

You don't really have a question here, and there's not going to be a substitute for "cracking the book", watching some on-line tutorials, etc. I appreciate you're in a tough spot, but just willy-nilly adding stuff to an .aspx file will cause you serious grief in the long run.
Do a Bing search for PHP an ASP.NET and you'll find some relevant resources that leverage skills you already do have to bring you into the ASP.NET mindset, explain the development and deployment model, and describe the page lifecycle model.
Here are a few:
ASP.NET for PHP Developers
Get Started with ASP.NET and ASP.NET MVC
ASP.NET for PHP Developers: Introduction to ASP.NET

Related

Code-blocks are not allowed in this file - Where is My web.confi file

I have a sharepoint at my office. Its 2013 version. Where I want to write some asp code. But the issue is SharePoint is blocking the code and I am getting error "Code blocks are not allowed in this file". I searched google and found several links to solve the issue by saying make some changes to the webconfig file.
Now my question is how do I find the file. Where it is actually.
What I have is a sharepoint, I don't have any designer. I only have admin access for this site. Can some one please guide me.
I know there are several entries here in stackoverflow, but no one is talking about where to find the file.
Please help me.
My apologies if this happens to be a repetition, in that case please point me to the right post. Thank you guys.
By default injecting server-side code (ASP.NET) in SharePoint pages directly from sites is not allowed for performance reasons, and should remain as is.
If you never approched SP developpment and are not an administrator of the farm in your company I strongly advise you to see first if you can solve your needs with client side development (javascript) instead of going to server side (ASP.NET).
SPS2013 comes with the "Script Editor WebPart" that you can use to inject your custom JS on pages. If you need your custom on all pages consider adding your JS on the site's masterpage.
From JS you can use SharePoint REST API to interact with your site https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service
If you need heavy customisation for your site you can move to the addin model (client side) that will require Visual Studio IDE develoment suite.
And last option is if you explicitly require serve side code and/or need to develop a scalable enterprise grade solution, you will need to make a "SharePoint full trust solution package".
PS: You may see articles around about "SharePoint Framework" (aka SPFx), unfortunatly this is not available for SPS2013.

How to find and remove unused .aspx files in Website project

Recently I've been working on a big ASP.NET Web Forms site and it has some pages that apparently are not in use anymore, but no one knows for sure (this is an inherited project). Is there a way to know if those .aspx files/pages are being used or referenced?
This is not a Web Application Project but a Web Site Project; so I guess it's more difficult to find what .aspx pages are being used and which ones are not. if anyone has experienced something like this, what was your approach to clean this up?
No, probably not. What would be the criteria for that, if no one knows for sure? If you developers can't tell, how would some automatic system decide this for you? You don't need to have .aspx referenced in code for them to be used.
You can use search function in VS to find references inside the project, but in a big website like yours it might be kinda slow and problematic. I'm afraid you'll have to go page by page and figure it out by yourself.

Can someone give me an overview of ASP.net and how it's different from technologies such as php?

I've been doing the html and css for a site, sending it off to a guy to implement in a web server. I get a call from the designer freaking out about the progress, saying the clients aren't happy. He wants me to personally integrate my css with what's on the site. The site is done in ASP.net, time is short, and I'm a little in over my head. I have an understanding of how php works, but have never worked extensively with it.
Looking at the stuff on the ftp, I can't even find equivalent of the index.html file (I know that when I go to the site itself, there is nothing after the base url, i.e., www.site.com/ brings me to the homepage.)
Can anyone give me a few tips or links as to what I am to do with this, or where to even being navigating this site?
EDIT: It's -not- a .Net Web Application, from the looks of it.
ASP.Net can be run in a compiled or a scripted environment. It is important to understand which environment your client has. If it is completely scripted, then you are likely looking for the default.aspx file and it's contents. If it is a compiled environment, you may be in for a ride. A compiled site may incorporate "master pages" as a templating engine, and then you'll need to apply your html/css modifications in several places.
You should start with the default.aspx page if there is one. Look for master page directives (it'll be named something like masterpage.master). If there isn't one, then you're in luck you'll just need to implement your changes on a page by page basis. The aspx page will be in a templated xml format so avoid touching tags that involve touching
If you are making changes to divs and structures of that nature, you may need to modify the CssClass attribute of the controls. I would recommend however that you make a back up, give it a shot, and under no circumstances attempt to do something that you aren't really ready to do. You will only anger the client and ruin your rep. It may actually be prudent to contact an actual ASP.Net developer to analyze the files separately and determine what you need to do.
I suggest that you read the Wikipedia article about ASP.NET to get familiarized with it as it summarizes the basic building structures.
Then, just to get you started: take a look at the more recent ASP.NET MVC (Model-View-Controller) paradigm. There's also development in what is called ASP.NET WebForms.
For example: when you go to www.site.com/ (known as friendly URLs) it may be redirecting you to an action method inside a controller. It's called routing. There's also URL rewrite.
In the MVC world a Controller can send/redirect the user to a specific View/Page.
A View (.aspx form/page) that contais HTML markup and CSS on the server side is basically an HTML page (.htm) page that'll be rendered on the client side.

Using master pages with multiple entities

I'm beginning to plan a complete redesign of our departments intranet pages. As it stands, every department gets their own folder within root. They all share the same look and feel but don't use CSS everything in each file is straight up static text. Basically, if a change has to be made to the header, every file must get changed. The number of files is somewhere in the hundreds. Since we're in the process of getting a new look & feel, I figured this would be the appropriate time to redesign the structure as a whole as well. My idea was to create a new C# Web Project to utilize the C# Master Pages. Within that project, each page would use the master page. Since I know they like to make many minor cosmetic changes, master pages would make things much simpler and quite frankly, I don't have time to manually edit a header 564 (random) times. The other aspect of this site is that the root would contain a documents folder within sub folders pertaining to each fo our departments.
Guess my question is, has anyone tackled an issue like this and could shed some light as to how they fixed it.
Also, would it be worth upgrading IIS and .NET to their latest version?
If you are already working in .NET 2.0, then you shouldn't need to do any upgrades, and there won't be any additional infrastructure cost.
I would highly recommend using Master pages, as they do make it painless to have a common look and feel for your entire site.
Another cool feature of Master pages is that you can nest them together. This would let you have a common feel between all pages. And then each department would have it's own Master page nested into your top-level page.
I'll start with the cost question. You need to be using ASP.NET 2.0 or higher to take advantage of master pages. Technically the .NET framework is free, however Visual Studio is not. Visual Web Developer is free, but the license might be for non-commercial projects only. I'm not sure. IIS is also free, Windows Server 2008 is not. You are fine running on XP or Server 2000/2003. There isn't really any reason to upgrade.
I can't say that I have tackled a problem exactly like yours, but it sounds like what you need is a content management system. Some examples are the cuyahoga project, or Umbraco. These systems allow you to create a general look and feel, and store all content in a database or xml files and provide an online content editor, so the content of the pages can be managed by people that don't necessarily know HTML or Programming.
You can have a master-page hierarchy:
Master page for everyone
Master page for department A
Master page for department B
Whatever's common for everyone you set in the first master page.
Then you make a master page for department A pages - this master page's master page is the first one.

asp.net help resource location

I have a relatively simple site that I'm working up for an intranet environment. The pages have a hook to display a simple bit of text (possibly with a bit of HTML for markup purposes) for help when the user clicks a link on the page. I'm debating whether to put the help snippets in their own XML file or create a section in web.config. The site is to be deployed across several client sites and given that updating a web.config file appears to restart the site, I'm leaning toward having it in its own file. My question is where would be the best place to locate it? I'd rather it weren't easily web-accessible, so although root or some folder is an option, I'm wondering if there is a more "standard" location for files like this, App_LocalResources perhaps? Any feedback would be welcome. Thanks.
I will look at these options. I don't anticipate a lot of updates to the help file/resource, but I think as the function of the site expands, it's certainly possible. I like the idea of it being something like XML or at least editable in a text editor so that updating doesn't necessarily require VS to update the file. Thanks all!
Sounds like a perfect candidate for resx (resource) files in the App_GlobalResources folder. Those are easily editable and posted to a site without any restarts.
What about using an embedded resource? There are several tutorials around how to use embedded resources and package it up in a dll to distribute along with your website.
In my projects, I connect the web application to an online help wiki wherever possible.
The .aspx page name is used as the help page title. Once you are in the wiki, you are free to do all the wiki tricks, such as redirecting and linking
See my blog entry for technical infos.

Resources