The way I create my menus is causing a slight problem. I define the style in my style-sheet and create a module with html in it, here's an example of the HTML:
<ul class="cmenu">
<li>Link1</li>
<li>Link2</li>
<li>Link3</li>
<li>Link4</li>
</ul>
My reason being I need multiple menus through out the site all with different links (much more simple than using dnn:NAV with options) and it's working very well.
But trying to create a link to a user profile in this way doesn't seem possible. When visiting my user profile for example I am taken to this link: "../UserProfile/tabid/57/userId/1/Default.aspx" which means to me that DNN is dynamically creating the link and the page is created from the provided link. Please correct me if I'm wrong here.
Also I would like to create new input fields, how do I go about this?
I've been developing in PHP/HTML/CSS/JS for years now, ASP.NET is quite new to me and I couldn't find anything on the subject, thus my questions.
I'm very familiar with C# and Visual Studio, I would like to use these tools to extend on the current Users and Roles structure if possible.
Thanks in advance!!
The URL for the profile is generated server side using the NavigateUrl method within the core.
To solve your HTML module issue in a primitive manner you could enable token replacement and use [User:UserID] as a token in the URL (Replace the 1 with the token in your example).
However, that doesn't work well for unauthenticated users as it will try to take them to -1. Honestly creating a menu might result you to create a custom module for it.
Related
I'm not sure if this is possible, but I'd like to allow a user to create a new .aspx page from a web interface. So, for example, say I was building a wiki site and wanted to allow a user to add an article on how helpful stackoverflow is. Is it possible to create a new .aspx page from a master page and then allow the user to add content to it? Also, it is possible to allow users to delete pages form a VS project?
Thanks,
Brent
Try content management systems, like:
WordPress
Joomla
DotNetNuke
or others.
if you install DotNetNuke (dnn), it wil be possible to have pages that look like: mydomain.com/wiki/mynewpage.aspx
But you might be better of using the DNN wiki module (or an article module) to allow the user to enter content (based on his/her user rights). These modules are espacially tailored at the task at hand.
Say there are three roles, namely:
Registered
Administrator
Sponsor
I'd like users to be able to self-register as Registered (easy enough out-of-box).
I'd like an Administrator to be able to see all registered users and check off the "Sponsor" checkbox, making the user a Sponsor.
Once the user is "checked" as a Sponsor, the Administrator should be able to add additional parameters for the Sponsor, including logo and Sponsor URL, which webpage(s) they are sponsoring, the valid date range for the sponsorship by webpage, the number of impressions and clicks, and also "paid/not paid".
I'm trying to wrap my head around Memberships and Profiles, and see how they apply to this.
Can anyone provide a general framework as to how I can properly architect this? Are there Nuget packages to do just this?
Advice appreciated.
Maybe my answer to another question will help a bit Using out of the box aspnet membership for public facing website
In Nuget - Thinktecture.IdentityModel is a way to go.
Use the table profile provider.
You can then edit the values in this table directly through a simple page.
Excluding the profile provider, is there an easy way to add custom fields to ASP.NET membership?
You can then use the web interface to assign a user to a role as an admin:
http://msdn.microsoft.com/en-us/library/t32yf0a9.aspx
Or simply code this page and use Roles.AddUserToRole
http://msdn.microsoft.com/en-us/library/system.web.security.roles.addusertorole.aspx
im starting the pseudo code of a new site, and want it to be as SEO friendly as possible.
the site i am creating is a booking agency site with c# and asp.net. essentially bands will register on the site with their availability and other info, and fill out their profile information with images etc. this info will be stored in a db.
creating this is not a problem, but i want the site to be a SEO friendly as possible.
I know google loves huge sites with great content. And all of these profile pages would be an excellent addition to my site for seo purposes. i also hear that google cannot see dynamically generated content when crawling a site.
i want to find a method of coding these pages, so google can see the content when it crawls them.
i need a pointer in the right direction for a solution for this. nothing is off limits - i will basically code my entire site around this principle, i just have no idea where to start looking for a solution. im not looking for a code solution, just what i should be researching to solve this issue.
Thanks in advance
i also hear that google cannot see dynamically generated content when crawling a site.
Google can see anything you can retrieve via http GET request (ie: there's a specific URL for it) and that someone either linked to or is listed in a published xml site map file.
To make sure that your profile pages fit this, you will want to make sure that profiles are all rendered via a single asp.net *.aspx file that determines which page is shown via a url parameter. Something that looks like this:
http://example.com/profiles.aspx?profile=SomeBandName
Now, you probably also want a friendly URL, that looks like this:
http://example.com/profiles/SomeBandName
To do that, you need to set up routing.
In order to crawl and index your pages by google or other search engine properly. Follow the following guidelines.
i: Page title must be precise and according to content available in page.
ii: Page url should be user friendly.
iii: Content is king (useful content)
iv: No ajax or javascript oriented way to load contents.
v: No flash or other media files. if exist must have description via alt tag.
vi: Create url sitemap of all static and dynamically generated contents.
vii: Submit sitemap to google and keep tracking how google crawl and index your pages.
fix issues contineously if google found via crawling.
In this way your most pages and content will be index properly and fastly.
I'd look into dynamic URL Rewriting.
Basically instead of having one page say http://localhost/Profile.aspx you'll have a bunch of simulated urls like
http://localhost/profiles/Band1
http://localhost/profiles/Band2
http://localhost/profiles/Band3
etc.
All of those will then map to back to the orgial profile.aspx page with a parameter so internally in your code it would look like http://localhost/Profile.aspx?Name=Band1, http://localhost/Profile.aspx?Name=Band2, etc
Basically your website appears to have a bunch of pages for each band but in reality they are all getting mapped back to the same asp.net page but have different parameters.
This is article I read about it some time back. http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
i also hear that google cannot see dynamically generated content when crawling a site.
you could create a sitemap.xml with the urls pointing to the dynamic profile pages. using google webmaster tools you can submit and monitor the crawling progress.
you may also create an index page or something similar ('browse by category' pages) that link to matching profile pages.
a reference for seo I regularly use is http://www.seomoz.org/learn-seo
I am looking for a solution that will allow me to print generic url for a set of pages.
Example:
For pages - site.com/About/Contact.aspx, site.com/About/WhoWeAre.aspx, site.com/About/Members.aspx etc., user should see only site.com/About/ in the address bar.
Is that something achievable? This site is not SEO friendly and requires users to login before accessing content, also I don't expect site.com/About/ or any internal pages to resolve to any page when typed directly on browser. I am also fine if real url is printed on status bar if the user hovers on the internal links. I don't think URL Rewrite or URL Routing works here. Or may be I am missing something. Using .NET 3.5 and C#.
I am tagging sitecore because I am more interested in sitecore based solution where I have different nodes under About tree and I want users to see only upto /About in the address bar, but I think if it can be done in asp.net, I can figure out sitecore part.
As you are interested in sitecore, I can tell you how we have done custom URL in a recent sitecore build.
You need to have a custom link manager by extending the current LinkProvider.LinkBuilder sitecore class. Then you need to add your custom logic on how you would like the URL by overriding GetItemUrl and BuidlItemUrl to display URL and finally and it in the web.config for sitecore to use your custom link manager.
Absolutely, use the asp.net 4 routing engine.
This will give you exactly what you want:
http://weblogs.asp.net/dotnetstories/archive/2011/01/03/routing-in-asp-net-4-0-web-forms.aspx
EDIT: for 3.5 check out:
Friendly URLs for ASP.NET
The only way to solve this, keeping /About in the address bar, would be to create client-side code that switches out the content based on user selection.
You can do that by loading the About page and then load the content for any child pages using a postback or using ajax calls.
You could also put an iframe on the /About page, and have the navigation links point the iframe to the other pages.
I think you might be able to use the target attribute to target the iframe, or use javascript to change the src of the iframe.
I need to create and add custom headers to an ASP.NET 2.0 application.
The case is simulation of an SSO-login in our dev/test environment.
When I try to add headers I run into the "Not supported on this platform."
error. BigJim has a nice post on the subject here:
http://bigjimindc.blogspot.com/2007/07/ms-kb928365-aspnet-requestheadersadd.html
The root of my problem lies in the fact that I need to simulate various
persons logging into my application. Not just adding static data in a
HttpModule. I need to take values from a couple of TextBoxes and transfer
information from these into custom headers and then re-direct the user. The
HttpModule stuff happens to early in the pipeline...
Does anyone now if there exsist a simple redirect/proxy solution that one
could use in a dev environment? Or have simple/beautiful way of doing it in code?
One method i have used before, though a long winded approach, is NUnitASP.
This is based on the NUnit framework but intended for ASP.NET UI Testing.
It basically starts a browser in memory, and is able to manipulate the content exactly like a user would.
Using this you could view your page, enter data into textboxes and submit pages.
Hopefully that can help you do the testing you require. I've used it to test load, and spider through sites of mine to gather data.
If you use IIS 7 you can set the Pipeline Mode to integrated
This Setting is found in the App-Pool Properties.
I could be wrong, but doesn't the Response.AddHeader() method still work? Although, I agree with Oscar that a formal testing solution like NUnitASP is a good idea. Although, NUnitASP is a little dated. I still use it for some of my projects just because it still does work; it just isn't as refined or as simple as WaTiN or similar projects.
The browser drops the header if you do a Response.AddHeader()...
The header must be added to the orginal Request...
why don't use ASP.NET forms authentication model?
you define your "private folders". if you attempt to acces to a private folder without login, you automatically are redirected to a your custom login page.
here's a couple of link:
http://support.microsoft.com/kb/301240
http://www.asp.net/learn/security/tutorial-02-cs.aspx