Currently I'm working on this project to create a SharePoint projects portal, but the context doesn't really matter. The problem is, all of my pages are custom Application Pages, and therefor reside in the _layouts folder. I'd like one of these pages (http://[servername]/[projectname]/_layouts/Pages/Summary/Default.aspx) to be shown whenever a user visits http://[servername]/[projectname].
After searching SP itself, the designer and Google, I couldn't seem to find a solution. I thought... let's try StackOverflow :-) Is it possible to let a _layouts page act as a homepage of a SP site?
We cannot set page (http://[servername]/[projectname]/_layouts/Pages/Summary/Default.aspx) to website welcome page because this page not the part of our current site.
You can set a page to web site welcome page that has the part of our current website. To do this you have to go Site Actions->Site Settings-> Welcome Page (under Look and Feel), set your page as welcome page that has the part of our site. For this you have enabled publishing feature on site.
You can avoid "this site" check from code.
SPFolder rootFolder = web.RootFolder;
rootFolder.Properties["vti_welcomepage"] = "any URL in layouts folder";
rootFolder.Update();``
We can do it.
I just tested in SharePoint 2013 Foundation.
It's a workaround but it works.
Steps:
1-In web.config allow server side code as follows:
<PageParserPaths>
<PageParserPath VirtualPath="/*" CompilationMode="Always"
AllowServerSideScript="true" />
</PageParserPaths>
2-Create a site page and set it as home page (use SharePoint Designer)
3-Edit html code of your site page (the one created in step 2) by including server side code as follows:
<%# Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("http://sp-2013/_layouts/15/SharePointProject3_SearchApplicationPage/search.aspx");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
</body>
</html>
Related
I am working with external tracking service. They sent my index.html file, which looks like this:
<html>
<head>
<!-- tag -->
<script type="text/javascript" src="//path.js"></script>
</head>
<body>
</body>
</html>
They want us to upload this file to shopify and sent them the url to it. The url should look like this https://myshopifyshop/index.html. I couldn't find any article how to upload or create new blank html page with .html extension. Is this somehow possible?
You can't create an html page that will follow the root url of your site.
But you can upload a html page as an asset and link that asset as a page.
Example url will be:
https://cdn.shopify.com/s/files/1/*****/*****/t/4/assets/index.html
But I don't think that this will do you any good, since tracking services requires you to track the current site and not a dummy file that no one will ever open.
It's highly possible that the only important part is the script and everything else is not needed.
So you actually may need to add the script in your layout/theme.liquid file and ignore the rest.
Please contact the the tracking service and let them know that you are not using a static HTML site, but a Shopify one and what steps should you follow.
I have an ASP.Net MVC5 based web app. I am using Bootstrap for the UI.
On my machine everything is perfect. After login, the following page is shown.
Analytics page as on localhost
After I deploy to the web server, I get the following page post login.
Analytics page from the server
You can see that the page from server is all messed up. It is almost like all divs are showing up with their borders. I am not sure what is going wrong here. Any inputs are most welcome.
Update:
I have another application "TalkApp" that has the same login page as this Analytics App. "TalkApp" UI has no issues.
So I checked the page source for the login page. The TalkApp has these links:
<link href="/TADATalk/Content/bootstrap.css" rel="stylesheet"/>
<link href="/TADATalk/Content/site.css" rel="stylesheet"/>
<script src="/TADATalk/Scripts/modernizr-2.8.3.js"></script>
<script src="/TADATalk/Scripts/jquery-3.1.1.js"></script>
<script src="/TADATalk/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/TADATalk/Scripts/jquery-ui-1.12.1.js"></script>
<script src="/TADATalk/Scripts/bootstrap.js"></script>
Whereas, the AnalyticsApp did not have these. Instead it had ..v="e34hgd5677.." type of entries. I removed use of bundles from AnalyticsApp and directly added the link refs. Now the UI loads properly.
So the question still stands: why did bundles not work with one app but work with another app (which is also deployed on the server).
The only thing I can think of as to why your bundles aren't loading but hardcoding css links does, is if you're not including them in your _Layout.cshtml. Here is an example from my application.
BundleConfig.cs (RegisterBundles method)
.... other bundles ...
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
... other bundles ...
_Layout.cshtml*
... other head stuff ...
#Styles.Render("~/Content/css") <--- this name is the "virtual path" to that bundle of styles
... other head stuff ...
You define the bundles in BundleConfig.cs, which gets called from your Global.asax.cs.ApplicationStart() method:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
ViewEngineConfig.RegisterEngines(ViewEngines.Engines);
}
This should all be setup in the older template startup project.
the reason of this question is because I am having troubles with a route address in MVC 4 application, what is happening here is that I have an action link in this way in a view:
<li>#Html.ActionLink("Description", "Action", "Controller")</li>
And when I run the app in the HTML in the web browser appear the link generated correct
<li>description</li>
but when I click on the link in the web address bar the destination route appears as follows:
http://localhost:port/#/Controller
Is inserting a "#" char in between, is doing this for all of the links in my different views, it do the same when I deploy the App in a web server too no only in my local and this makes that the destination page don't appear correct, I don't know the reason of this, I have been searching but without success, hope you can help me, thanks in advance.
I found the reason for that behavior, it was because I have the script load for jquery mobile on the head section in the _Layout_cshtml file like this
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
<meta name="viewport" content="width=device-width" />
#Scripts.Render("~/bundles/jquery")
#Styles.Render("~/Content/mobilecss", "~/Content/css")
#Scripts.Render("~/bundles/modernizr")
#Scripts.Render("~/bundles/jquerymobile")
</head>
What I do was change the location of jquerymobile script to the end of the _Layout.cshtml
#Scripts.Render("~/bundles/jquerymobile")
#RenderSection("scripts", required: false)
</body>
With this change the web route was created correctly, I hope this helps to somebody.
I would like to use the Page Viewer web part to display an html page with some java script. That page is to be hosted as a stand-alone page within SharePoint (perhaps under Shared Documents folder).
The problem is this: when I point the Web Part to use the page, it prompts me to save the html file rather than displaying its content inside the web part.
I am following general rules to create the html file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Little SharePopint Page</title>
</head>
<body>
<div id="PlayerName">
</div>
<div id="display">
</div>
</body>
</html>
So I just need the page to be displayed inside the Page Viewer web part - and not to be prompted to save it as a file.
You web application configuration is forcing your users to download the file, this is by design and by default, you can change it in "Web Application General Settings" in central administration. look for "Browser File Handling" make sure its not strict. Check technet
page about this setting.
This can have security implications (Like loading PDF files inside the browser windows). There are other ways to accomplish this using js.
You need to remove everything north and south of the body tags first, they are already present through SharePoint. Then load the file (with just the div content) to your doc library and use the page viewer to point to that file.
I note that you are using PlayerName, impling that there is some type of flash/video player content to come later, depending on the object settings used that will also cause a "download" file display too.
As I understand it you can tell the IE8 (and I assume later versions) how to best render your page.
This is useful because the page may have been designed for IE7, quirks mode or to target IE8 standards mode. As I have it, the default behaviour for IE8 when it encounters a page is to render in IE8 standards mode (not sure how it interprets the DOCTYPE though). With this default the user could change the rendering mode by clicking on the "Compatibility View" button next to the refresh button.
This is nice to give the user some control, but bad when you know your site only renders well with IE7 or whatever. In that case you don't want to enable the user to make the wrong choice and that's where the ability for a website to tell the >= IE8 browser how to render the page is very useful.
You simply have to provide the X-UA-Compatible meta tag the within the head tag. There are loads of references on the web how to do this and what values can be used. Remember to make it the first one.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
OK, so it's nothing new so far - however it just doesn't work for my ASP.NET project? I've tried it on a couple of other projects I have and the same problem.
Is there perhaps a scenario where because I'm using developer tools like Visual Studio, etc. that IE has been configured to always show the "Compatibility View" button for debugging purposes? Grasping at straws here I know.
I found out why this is happening.
It seems that ASP.NET's theming is interfering. When looking at the rendred output there is a dynamically inserted tag for the stylesheet (one for each) from the theme.
The ASP.NET theming engine inserts these items above the X-UA-Compatible meta tag, thus breaking IE's expectation of having it as the first tag in the head element.
So an ASP.NET site that has theming and the following in the source:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
will get rendered out as follows:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="ctl00_Head1">
<link href="App_Themes/White/Default.css" type="text/css" rel="stylesheet" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
This seems to be a bit of a bug. I'll create a MS Connect issue for it.
There's an interesting workaround for this here . I'll include the gist to make it easier:
The "styleSheetTheme" setting always places its CSS file in the header
at the top before anything else. To move the "X-UA-Compatible" before
it, you would have to do the following:
Make the meta tag accessible from the server code by giving it an ID and add the "runat" attribute:
...
Add the following pre-render event handler to your page (or master page):
protected void Page_PreRender(object sender, EventArgs e)
{
Control MyFirstCtrl = Page.Header.FindControl("FirstCtrlID");
Page.Header.Controls.Remove(MyFirstCtrl);
Page.Header.Controls.AddAt(0, MyFirstCtrl);
}
You can move things around in the header this way for anything that
you explicitly define in there.