Integrating Umbraco and Intelligencia UrlRewriter - vb.net

I have used Intellegencia UrlRewriter for a while now.
I used it with VB class that looks up the product Name and gets the relevant ID number to use for the querystring.
It works great.
How can I do the same thing in Umbraco?
I have thought of 1 way:
To use url structure of ~/products/product_name/ (which is really ~/products/product.aspx?id=XX) and add ~/products/* as a reserved folder and basically take this entire page out of Umbraco.
The problem is that my client would like the site structure to be ~/product_name/ (not in a subfolder). My problem is that I don't think I have any way to tell Umbraco not to handle these pages.
Can anyone help me?

You can inform umbraco to ignore paths with the following appSettings key in your web.config:
<appSettings>
....
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/product_name/" />
This key is included in the web.config by default so you can search umbracoReservedPaths and you will find it. Simply add your path and umbraco will ignore it. You may also specify individual pages with the umbracoReservedUrls appSetting key.
Of note, you will see that in the /config/ folder there is a UrlRewritting.config for the urlrewritting.net rewritter already integrated into your umbraco install.

Related

Rename wp-login.php with default permalink

For better security, I would like to rename the login url of my blog to something other than /wp-login.php. I found a plugin that would do the Job
http://wordpress.org/plugins/rename-wp-login/
But the problem is that it works only with non-default permalinks, which is a problem for me, because I use unicode names for my topics, which could make the link very long and messy with percent encoding. I wouldn't want to translate every link name to english... that's tedious!
Is there a way to hide wp-login.php and wp-admin from hackers without having to change the permalink form?
Thank you.
You can now use Rename wp-login.php plugin with any kind of permalink structure! ;)
I can suggest one great plugin that have plenty useful things in it and also what you want. And it uses other technique, that is not dependent on permalinks (in two words - it uses htaccess for all the magic).
It's called Better WP Security.
Here is the link
Why don't you use a permalink structure like this?
/%post_id%/
From long time i was tackiling with one issue.
some one trying to access my website using random password.
i got report of ip addresss, who hits wp-login.php files.
beside that i found .sd0 file in my root folder.
that file filled with some encrypted code.
I removed this and change my wp-login.php to wp-login-xx.php
After changed this file you required to change below file also to get proper execution.
search for wp-login.php and replace this with your assign name (wp-login-xx.php)
wp-login.php
wp-includes/general-template.php
wp-includes/pluggable.php
for better security also update wordpress with latest one.

Roles.GetRolesForUser() is empty

I have never worked on authorization in Vb.Net before. So the below question might sound stupid for advanced programmers. Please apologize.
I am trying to get the list of the Active Directory Groups of the logged in user. I was told that Roles.GetRolesForUser() is the best way to achieve it. I wrote the below code in my web.config.
<roleManager
enabled="true"
cacheRolesInCookie="true" >
</roleManager>
and added the below code in code behind.
Dim userRoles As String() = Roles.GetRolesForUser()
I see the userRoles.length is 0. I verified the user is having more than one active directory groups associated with. Either this is because the configuration which I set in web.config is wrong or this is not the way to get all the active directory groups for this user. Any suggestions are appreciated.
Either I am too stupid to understand the Roles.GetRolesForUser() or configuring it is really hard.:)
I solved this problem using IsInRole() method. I knew the possible ADGroups which would access my app and made that as a configurable item in web.config. Then used String.Split() and then manually checked with HttpContext.Current.User.IsInRole() to verify the user can access the app.

Apart from affecting the bundling in the global.asax is there any way to manually add script and css on razor pages?

When mvc3 was created I placed one of these on my _layout.cshtml page...
#Html.RenderCss()
#Html.RenderScript()
Then in my inheriting razor pages I did this...
#Html.RegisterScript("~/Content/scripts/myscript.js")
Is there now an automatic way to do this with the optimisation dlls that. I dont really want to bundle everything in the folder all the time. Id also like it to minify the file too automatically. Not sure if im missing the point of this bundling feature but i just want to add files dynamically and then have them render out all at the same place on the page...
Thanks...
My understanding of the bundling feature, which is still pre-release and somewhat buggy is that it is designed to combine and then minify all of your CSS or JS files you might need in your project. It then uses a versioning mechanism so that clients get the full browser caching experience.
For example if I have 3 CSS files (Reset.css, Global.css, and Site.css) these all get downloaded on the first visit to my site, they are combined and minified so the file size is quite small. The url contains a special hash number/querystring. As long as I don't change the content the cached copy stays on the client until it expires or they clear their temp files. When I make a change the old version is discarded and a new hash is created. When the client visits again their file is now invalid and it redownloads the new file.
I personally have not tried to create specific bundles but with a search I found someone who has created a custom bundle, I think this may be along the lines of what you are trying to accomplish: http://www.codeproject.com/Tips/389545/ASP-NET-MVC4-Bundling-and-Minification

SharePoint 2010 development

I am working on visual web parts. I created a sharepoint project in VS2010 and added one visual web part to it.Built this and deployed.I am able to see the web part added and I can drag that to any page on site.
Now I created a new solution redirecting to same site (site to which first solution was pointing). Added one visual web part to it.Built this and deployed too.now when I see the site though I can add this new webpart to the page but the webpart added from previous solution are throwing error.
Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type TestWebPart1.Testwebpart.Testwebpart, TestWebPart1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=02dc69d4b9065085 could not be found or it is not registered as safe.
Looks Like I can not work with more than one solution for a single site. May I get the reason for this?
This usually means your webparts assembly isn't registered among the safecontrols in the sharepoint web.config OR that you didn't create a strongly typed assembly
To register in safecontrols
To fix open your web.config located in the iis root site of your sharepoint server, usual path is something like
c:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config
Add the following in the <SafeControls> section
<SafeControl Assembly="TestWebPart1.Testwebpart.Testwebpart, TestWebPart1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=02dc69d4b9065085" Namespace="TestWebPart1" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
Signing assemblies
http://msdn.microsoft.com/en-us/library/ms247123(v=vs.80).aspx
I'm not sure if it's the case but; here's an theory:
You may have created the webparts with the same namespace and name but within different solutions.
So what is going on is; the first solution gives the webpart's binary a unique id like "1" and the other one is giving "2" for instance.
So the first deployed web part's binary is overwritten with the binary with Id = "2" since they have the same names, but the unique Id of the binary is the newer one's id.
So the first one's controls are looking for a binary with Id = "1" and cannot find it.
That may be the error you're receiving.
You've got to change the names.
If this is the case, let me know and I'll add some comments on the naming conventions you can use.
Its not very clear what you are trying to achieve.
But you can have as many solution as you want for a site. There is no 1 solution restriction

Store and Retrieve values from web.config

I built a small website and there will be only one admin, so in the admin panel I am asking for a password with a value that I do not retrieve from a database, I just hard coded it in the function in code behind, I know this is wrong though I don't know why.
So is hard coding it in web.config the right thing to do? and how?
As far as it being wrong... the problem is that if you ever need to change it, and it's hardcoded in your codebehind, you need to recompile,republish, re-deploy your website, whereas a change to the web.config can be done without doing this.
You could put it in an AppSetting in the web.config like so.
<appSettings>
<add key="AdminPassword" value="ASDF1234" />
</appSettings>
and use this code to retrieve it
System.Configuration.ConfigurationManager.AppSettings["AdminPassword"].ToString()
Though I'd have a look at this.
https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx
It covers encrypting sections of your web.config
Nothing wrong with Eoin's suggestion for tiny projects but if your project may someday need more than 1 admin and different types of users roles. I would take the hit and setup ASP membership.
http://msdn.microsoft.com/en-us/library/ms998347.aspx
You can use integrate it into windows or use a database and it's not too hard to setup. Especially if you use the built in config tool in IIS.