I have a website, which imports user controls (.ascx) into a directory of a live website.
Obviously, once the user control is imported into the directory, it is not actually 'part' of the website, it's just a .ascx file sitting in a directory on the website.
When I try to add the user control to a panel, I get a "Could not load type 'CMS.Modules.HelloWorld'." error.
Control content = LoadControl(#"~/Modules/" + ddlExtraModules.SelectedValue.ToString() + "/HelloWorld.ascx");
pnlSections.Controls.Add(content);
Is it actually possible to add user controls to a website 'on the fly'?
Looks like you can dynamically add ascx files to web applications as they are compiled at run time. Use them only on webforms and do not request them directly.
http://msdn.microsoft.com/en-us/library/system.web.ui.usercontrol.aspx
In addition, the designer creates the # Register directive, which is
required for the page to recognize the user control.
http://msdn.microsoft.com/en-us/library/5d0t5fak%28v=vs.80%29.aspx
Related
I'm trying to implement permission levels in SharePoint hosted app. I've created a custom list "Permissions" where I'm adding different users with their roles.
I have created a page List.aspx where I'm showing my custom list "Products" as a list view web part. Page List.aspx checks the user's role against "Permissions" list, and page can show or hide content in regards to this role. The problem is, when user tries to navigate to "Lists/Products/Allitems.aspx" or "Lists/Permissions/Allitems.aspx" he can see the list items.
All code check is done in JavaScript and I know there is a security risk, but this will work for my users. I just need to find a way to inject custom JavaScript code to Allitems.aspx, and to check if user has permissions to see it or not.
Everything here is done on App web and there's nothing that I use on host web.
I've found a workaround for this. Basically what I did is that I just hide the list view from direct access. To achieve this, open the Schema.xml of the list and replace "JSLink":
from
<JSLink>clienttemplates.js</JSLink>
to
<JSLink>~site/Scripts/OverrideListView.js</JSLink>
Now, create a new file Scripts/OverrideListView.js and add following code to it:
document.write("<style>body {display:none; };</style>");
Try now to access Lists/Permissions/Allitems.aspx directly. You will get a blank page.
This is basically idea how to insert custom JS code into list view. You could add additional code for checking current user's permissions on site level and in regards to it to unhide this view, or even to redirect him to the homepage if he does not have right role or permissions.
Am developing my first Xpage application and have designed a login screen in domcfg.nsf. So when user types my url like Myrequest.com(dummy url) this should redirect me to the login page and then on succesful login attempt the page should be redirected to Myrequest pplication. Could you please let me know how to configure in server document or Internet site document. ?
As a first step,I executed the below points.
Enabled Load Internet configurations from server/Internet sites
documents in the basic tab of server document.
Created new web site document by clicking on web>>Internet sites Web
Site-Basic Tab::
a. Descriptive name for this site :myRequest.com;
b. Organization: testCompany;
c. Use this web site to handle requests which cannot be mapped to any other
web sites: NO ;
d. Host names or addresses mapped to this site: my local ip address;
e. Domino server that host this site : *
In Web Site-Configuration Tab::
a. Home URL : /myApp/myRequest.nsf?open
The rest of the configuration are all default's
When I tried opening myRequest.com no page is displayed. I guess i have made a mistake. Do i have to change any configurations ?
The way this works is:
Set up an internet site (remember to check that your Domino server is using internet sites (first tab in the server document)
The internet site should not contain any information about login - just the right path etc. for the domain/subdomain to point at the right page in the right database (and possibly url redirections, headers, etc.)
Now create the login form, e.g. in your application database (or any other applicable database). Make sure that you have the right fields on it for the login to work - and any error messages to be correctly shown. The easiest way is to look at the standard login form (its called "$$LoginUserForm") found in domcfg.nsf (if domcfg.nsf does not exist, just create it with that name based on advanced template "Domino Web Server Configuration (8)" (template file: domcfg5.ntf)
Now create a Sign In Form Mapping document in domcfg.nsf. Select the specific domain/subdomain that it applies to (or a default for all websites not using another specific sign-in form), specify the path to the database with the form (e.g. your application database), and specify the name of your login form in that database
Now you just need to turn on the mechanism that will require your users to log in. This is done in the ACL of your database. When a user is not logged in it will obey the rules of a person entry with the name "Anonymous". If this "person" is not present in the ACL it will of course obey the default settings. You will have to determine when you want your user to log in. If you specify "No Access" then you may have to set "public read" on some of your design elements for the login form to display properly (e.g. graphic files etc.) and then you should also allow the Anonymous person to read public files (in the ACL). You may also want users to be able to read content and only be forced to log in when they want to write/change something, in which case your Anonymous user would be reader and default (or a specific group, etc.) would be author/editor - but that is all about standard Domino security/ACL and not related to web/XPages ;-)
/John
I need to create a "custom" web page in Orchard. As I understand it, below are the steps I need to take to do so. Before I go down this somewhat lengthy process, are there any steps I'm missing or that I can skip?
Create a model
Create a content part and content part record which use the above model
Create a driver which implements the Display method which returns the "shape" of the content part
Create a shape template to render the shape returned from the above driver
Create a content type which holds the content part
Create a page which holds the content type
Add the page to my site
This page is "custom", in the sense that it needs to pull data from a web service and display it in an interactive way. When the user makes changes, those changes will need to be sent back to the web service.
Those are really steps for creating a content item. You would want to create a content item if your page should be treated as content - e.g. administrators can create, edit, publish, unpublish, and finally delete your page.
If you just want to create a simple page, then there is nothing to stop you from creating your own ASP MVC controller. You can define routes for it using Orchard's routing, and if you decorate it with a [Themed] attribute, it will even inherit the site's theme.
I have created as custom task edit browser enabled Infopath form which successfully gets open when user clicks on Edit task. But by default it opens up in the WrkTaskIP.aspx page which is available in 12 hive..Layouts folder.
Now the default WrkTaskIP form provides two following options as hyperlinks
1. Delete item, and
2. A link to navigate to the task display form
I want to customize the OOB, WrkTaskIP page and associate that with my workflow.
How exactly can i achieve this ?
Thanks.
Assuming you've got a custom task content type you can create a custom feature with an application page and make the task open the form in this page instead.
Copy the WkrTaskIP.aspx page from the 12 hive, modify the contents as you require and deploy this as an application page.
Then in your taskcontenttype.xml file point to your custom page by setting the Display or Edit values to the deployed location of your custom page:
<FormUrls...>
<Display>_layouts/YourCompany/Workflow/YourWrkTaskIIP.aspx</Display>
<Edit>_layouts/YourCompany/Workflow/YourWrkTaskIIP.aspx</Edit>
</FormUrls>
The Infragistics images and javascript files are located on the server in: "\nasmoss\c$\Inetpub\wwwroot\aspnet_client\Infragistics".
I created a page and put it in the _layouts folder in Sharepoint. It is just a hierarchical grid. It has the + to expand the group.
For certian users, it displays a red X showing the images are not available. I also get javascript errors since it can't get access to the javascript include files from Infragistics.
If I login with a network admin login, it works. If I login with my normal user account it works sometimes. The fix is to login with my admin account and then login with my noraml account.
This also affects other normal users. If they get the red X I just login with my admin account. It then works for them for a while.
It appears it is some rights issue with Sharepoint. But it is very intermittent. I can't reproduce it. It normally stops working in a day sometimes hours. We don't use that page very often (twice a week).
If I right click and get the full path to the image it is to WebResource.axd.
https://sharepoint.{domain}.com/WebResource.axd?d=I9i-y5iGqdXx3n6e-hSXFEHlcHb2DBAtYdLbT5A8vP6aSSCjd8JdrowGqkDSq5wmAwCgXjgrfYNtCF93yfPliD2yteSxJvg7xIPVnlttFE7Wxg6qGtLaLI18s2hN40PO0&t=633480367580000000
If I have a user put that into their browser, they get an "access denied" error when it is not working. Otherwise they get the + image.
Perhaps it is a caching issue?
Thanks,
Gary Milke
If it's a WebResource.axd it usually means the image is an assembly resource. If the axd somehow gets the images from the filesystem, it might be so that the perrmissions on the folder you mentioned are incorrect. the AD groups WPG_... (i.e. all groups that have capital WPG in their name) and IIS_IUSRS should have read permissions on any file that needs to be accessible in your site.
Especially for files copied directly into the 12 hive this might not be the case.