i need to change all the sub-site default page url to my custom layout page url.
for ex: i have a one sub site call : http://test:1210/Site1/default.aspx. using coding i want to set this to : http://test:1210/Site1/_layouts/pages/test1.aspx.
is it possible in team site to change default page url using coding.
Team site default pages are default.aspx, so you have to do something like this:
http://attis.org/blogs/dan/archive/2008/10/29/how-to-change-the-default-page-of-a-sharepoint-site-using-a-feature.aspx
If you were using the publishing feature, you could set the welcome page
https://serverfault.com/questions/183943/change-sharepoint-team-site-home-page
Here is the easiest way to set the default page in a Team Site from code behind :
SPFolder rootFolder = Web.RootFolder; // root folder of the web object
rootFolder.WelcomePage = "SitePages/xyz.aspx"; // url of the page you want to set as default page
rootFolder.Update();
Related
Can any body help me to resolve url (route url) in MVC
when i enter into the system it redirects me to Dashboard it works perfectly.
I have user defined menu whose routing value stored in database as follows
suppose i entered into the system it will redirect me to Dashboard page
suppose i want to redirect to usermaster page then url should be as follows
http://localhost:6782/Home/Index
but when i try to redirect to home index page the url should look like this
http://localhost:6782/Dashboard/~/Voucher/Create
i want to remove Dashboard/~
how plz let me know
If you're using IIS URL Rewriting within your MVC application, e.g. internally treating http://yoursubdomain.example.com/MyController/MyAction as http://hosted.example.com/yoursubdomain/MyController/MyAction, Url.Content() will generate a correct subdomain-relative link. ResolveUrl() will generate an incorrect link in this situation.
Source:Should I use Url.Content() or ResolveUrl() in my MVC views?
You should consider about #Url.Content("~\Action\").
You should not store the URL in the database as the URL may change according to the routing rules.
Try to store the controller name and action name in the database and in your code that builds the menu use #Url.Action and pass the controller and action retrieved from the database
I have a file called "index.html" that I don't want to convert to a View in my project. When I browse to this file, I see:
"mydomain.com/index.html"
in the browser's address window, but I would instead just like to see:
"mydomain.com"
How can I accomplish this in an ASP.NET MVC project?
If you are navigating to it you can link to the root of your site "/" or "mydomain.com" instead of "index.html". Example:
Instead of this:
Some Page
Do this:
Some Pag
Just a suggestion but I would just convert the file to a view so you can take advantage of the framework as well as things like routing to display the url how you want.
You can modify the url after the page has loaded with javascript:
window.history.pushState("yada", "Title", "/mydomain.com");
See this and this
am developing an application in which i have to show the customer purchase details supplier wise. for that i have develop user control an add it on page. but the problem it that on user control i need to add a ling to promotional offer page for that supplier which show the current offers of the supplier. for that i have added the hyperlink as fallow to user control
<asp:HyperLink ID="PromoLink" runat="server">Have promo Code ?</asp:HyperLink>
and set the navigation URL as fallow
PromoLink.NavigateUrl = "Promotion.aspx?Filter=" + dt.Rows[0]["SuppId"].ToString();
but when page is load in does not render the navigation url to the link.
i donot why it does not render the url plz help to get out of this.
thanks in advance.
Make sure that the pathing is correct for the NavigateURL property. Try adding "~/" at the start of the NavigateURL or "../" if it is not in the same folder as the current file.
Make sure that the dt.Rows[0]["SuppId"] is actually getting the value that you expect.
Step through code in the debugger to verify that the Page_Load event that you are using is actually executing and modifying the value as you would expect it to.
One of our Umbraco sites is getting a bit messy and I was wondering if there was a way of grouping pages in folders without affecting the URL. So for example if under the homepage I have some top level sections, some footer links and various other system pages. I'd like to group the footer pages in a footer folder, the system pages in a system folder but I don't want all the URLs to become /footer/page1, system/contact etc.
Is there a nice way of doing this, maybe something with umbracoUrlName?
There are two answers, first you could turn on the 'hide root folder' option in web.config - then you can have as many folders in the root as you like - without them forming part of the url.
umbracoHideTopLevelNodeFromPath Causes the top level content items to
be excluded from any url paths. For example, this is pre-set to True,
so:
[Content]Home = /home.aspx or /home/
[Content]Home\Projects = /projects.aspx or /projects/
[Content]Footer\Page1 = /page1.aspx or /page1/
[Content]Home\Projects\About = /projects/about.aspx or /projects/about/
http://our.umbraco.org/wiki/reference/webconfig
Secondly there are four 'hidden' redirect fields on every umbraco node (which you can add into the document type) which can change the url routing:
umbracoRedirect (content picker) - Umbraco will redirect to the picked page
umbracoInternalRedirectId (content picker) - Umbraco will load the picked page without changing the url
umbracoUrlName (textstring) - Umbraco will override the page’s default url
umbracoUrlAlias (textstring) - You can have several urls for the same page (not sure when this is useful)
So I guess in your scenario umbracoUrlName will pick out a page in your combined folder but with a url that you choose.
So you have
homepage
|- footer
|-page1 (umbracoUrl = "/footer-page1/")
and /footer-page1/ would render your page stored in the footer folder.
You could also hack things about and make umbracoRedirect & umbracoInternalRedirectId work but I'm not sure that it would help.
This is a bit of a puzzle for me.
I need to capture the URI Query string passed to the Home page.
As a user travels to different pages on the web site, I have a partial view that needs that URI query string.
I need a dynamicly created link in the partial view, that equals the original call to the home page.
Example -
If the user goes to - http://www.mysite.com?mode=Joe , I need the dynamicly created link to equal - Http://www.mysite.com?mode=Joe
If the user goes to - http://www.mysite.com?mode=Tommy , I need the dynamicly created link to equal - Http://www.mysite.com?mode=Tommy
FYI - The partial view is used in the _Layout.cshtml file. the call inside - _Layout.cshtml looks like this -
#Html.Partial("MyPartial")
Thanks!
There are a number of ways to do this, but probably the simplest would be to save it to the session on your home page, and then access that session variable from your partial.
You will need to decide what to do if the session expires.
Another possible way would be to write it to a cookie on the home page request and then access the request cookie in your partial. Again, you'd need to decide on an approach for cookies disabled, or wiped out during browsing.
Alternatively, you could look at something like the approach being used in the link below to set a language across the site. Exact implementation would differ, but concept is the same:
Howto automatically add a specific value from current route to all generated links?