asp.net help resource location - asp.net

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.

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.

beginners query about asp.net website management

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

How and where to add a robots.txt file to an ASP.net web application?

I am using ASP.net with C#.
To increase the searchability of my site in Google, I have searched & found out that I can do it by using my robots.txt, but I really don't have any idea how to create it and where can I place my tag like ASP.net, C# in my txt file.
Also, please let me know the necessary steps to include it in my application.
robots.txt is a text file in the root folder that sets certain rules for the search robots, mainly which folders to access and what not. You can read more about it here: http://www.robotstxt.org/robotstxt.html
The robots.txt file is placed at the root of your website and is used to control where search spiders are allowed to go, e.g., you may not want them in your /js folder. As usual, wikipedia has a great write up
I think you may find SiteMaps more useful though. This is an XML file which you produce representing the content of your site. You then push this to the main search engines. Although started by Google all the main search engines have now agreed to follow a standard schema.
Increasing your Google score, and SEO in general, isn't something I've know much about. It sounds like a black art to me :) Check out the IIS SEO Toolkit though, it may offer some pointers.
Most search engines will index your site unless a robots.txt tells it not to. In other words, robots.txt is generally used to exclude robots from your site.

ASP.Net website makes browser load unwanted (non-referenced) plugins

I've found that some of my ASP.Net web apps prompt the browser to load plugins that I'm not explicitely using and certainly haven't deliberately referenced in the project settings.
Two that come to mind are for MS MediaPlayer and the "SVG Viewer for Netscape".
The only commonality I've determined so far is that the two sites/apps affected both use Master pages (nested in some cases).
We don't use SVG file types (just the normal mix of jpg/gif/png) and no video/audio (not yet anyway).
Can anyone provide a hint as to where the references for these might be creeping in? e.g. Is it a server-level include? Or a .Net runtime default when using master pages?
Does anyone else even experience this, or is it just me?
No urgency, I'd just like to remove it if possible.
Thanks.
Al
If you look at the page source in your browser, you should see what's in the page that requires a plugin. If you load external Javascript, you will have to look at that too. Do you have ads on the site that include 3rd party code?

Resources