AutoCompleteExtender not working in DotNetNuke - autocomplete

I am using DNN 6.0 and VS2008 AjaxControl Tool kit 3.5
I am trying to add ASP.NET AutoCompleteExtender to a text box in one of my modules in DNN.
As far as I know the AutoCompleteExtender works only through a webservice.
I've added a webservice, but I can not get the AutoCompleteExtender to work, I get no errors but the webservice never gets invoked, What am I missing or how can I get the ASP.NET AutoCompleteExtender to work?
Thank You

In my case it was the following problem:
ERROR MSG: Only Web services with a [ScriptService] attribute on the class definition can be called from script.
Try to put [ScriptService] as a definition of your web service class.
Example:
[WebService(Namespace = "http://dnndev/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[ScriptService]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class BusinessDataProvider : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod]
public string[] GetSpecificListOfContributors(string prefixText, int count)
{
return ContributorController.GetSpecificListOfContributors(prefixText, count);
}
}
I hope this one will help you.
Best,

Related

How to configure resetpassword

I am using IdentityServer3 for authentication. Users are stored using AspnetIdentity framework. I wanted to provide reset password functionality to users. I want to provide this functionality in IdentityServer hosting application. I have gone through several posts here here here and this what I have done so far:
1>I have created custom user service derived from AspNetIdentityUserService.
2>Created resetpassword.html and put it in template folder. (documentation)
3>It's not necessary to create a CustomViewService, so I added LoginPageLink in AuthenticationOptions and now the link is available on login page.
4>Created ResetPasswordController
public class ResetPasswordController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ResetPassword(string username)
{
// call customservice here and reset password
return View();
}
}
Issue
when i click on the resetpassword link, i get error
The view 'Index' or its master was not found or no view engine
supports the searched locations. The following locations were
searched: ~/Views/resetpassword/Index.aspx
~/Views/resetpassword/Index.ascx ~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx ~/Views/resetpassword/Index.cshtml
~/Views/resetpassword/Index.vbhtml ~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
I know why the error is, its because we don't have corresponding view in Views folder where MVC framework in looking for. My view resetpassword.html is in template folder. And that's the confusion. Identity server is using Angular to build its views.
If I decide to use angular then
1>How do I create and pass model to resetpassword.html.
2>How do I wire-up my CustomUserService to controller.
If I use ASP.NET MVC then
1>I need to add resetpassword.cshtml in Views folder and also a new Layout.cshtml in shared folder.
2>Doing so MVC scafolding will add bootstrap resources (css,js, jquery). The version may not match with IdentityServer's embedded resources.
I am comfortable coding ASP.NET MVC but worried adding bootstrap resources twice in the solution.
What is the best and easy approach here. Any sample example will be greatly appreciated.

App with no DB: You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class

First things first. I'm a complete OAuth newbie. This will be my first stab at it, and things are getting hairy...
I'm writing a single page application using Durandal & Web API.
The user needs to be able to login using any social network.
I don't have access to a database whatsoever, I have to call an unprotected 3rd party web service which I consume server-side, and need to protect using OAuth.
So I've managed to add the files to my solution which generates the login using facebook contol/button (created a new MVC4 web application, and did a manual copy and paste of all the auth related files, updated bootstrappers etc..), and the code seems to work for the most part.
When facebook redirects back to
[AllowAnonymous]
public ActionResult ExternalLoginCallback(string returnUrl)
{
AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(this.Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl }));
if (!result.IsSuccessful)
{
return this.RedirectToAction("ExternalLoginFailure");
}
if (OAuthWebSecurity.Login(result.Provider, result.ProviderUserId, createPersistentCookie: false))
{
return this.RedirectToLocal(returnUrl);
}
//code removed for brevity ....
}
I get the error specified once the following line tries to execute.
OAuthWebSecurity.Login(result.Provider, result.ProviderUserId, createPersistentCookie: false)
I've removed the [InitializeSimpleMembership] attribute from the controller, as I don't have a database.
Please forgive me if this is the dumbest question ever, but...
Why does the login fail? I mean at that point, isn't the app trying to log into facebook, why does it need a databse? Or am I correct in saying I can remove/replace that code section, with a login/authorise call on the web-service I'm using?
Not the dumbest question ever. Not by a long shot. But you are getting the error because your membership provider is still set to use the SimpleMembershipProvider and OAuthWebSecurity will use the default membership provider. If you don't want to use a database you will have to create or find a different membership provider to use.
EDIT:
I know you said you don't have access to a DB but if you can use SQL Compact you can just stick with the default SimpleMembershipProvider(check out Hanselman's blog) or DevArt has a SQLLite provider. Also the MemFlex Project has a RavenDb provider. If none of those work I think you might just have to write your own.

Use RESTful URLs in a non-MVC site

I started the site using AST.NET Razor template, not ASP.NET MVC template.
I recall seeing somewhere on the Internet that even without MVC, it's possible to use RESTFul URLs in the razor-based ASP.NET site. It appears to work without the CHTML extension names right out of the box -- www.test.com/car automatically redirects to www.test.com/car.cshtml.
But, what if I used www.test.com/car/2, how would I get to the "2" inside the View without using MVC? I really hope that's something already baked in.
Found it -- it's in UrlData
http://beta.asp.net/web-pages/tutorials/aspnet-razor-pages/18-customizing-site-wide-behavior
section "How Routing Works"
Look at the WebGet Attribute. It has a UriTemplate.
Example:
WebGet(UriTempate="{Id}")<br>
public JsonResult Get(int Id)
{
}

Application doesn't read action result method in MVC3

We are using MVC3 and we are trying to create a method in a Controller named UserSesionManager. This method is called from
#using (Html.BeginForm("GetStatTypesDistribution", "UserSesionManager", FormMethod.Post, new { enctype = "multipart/form-data" }))
In the UserSesionmanager Controller we have:
[HttpPost]
public ActionResult GetStatTypesDistribution(FormCollection form)
However when we call it we get this error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /UserSesionManager/GetStatTypesDistribution
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Also, whe I add a breakpoint it says that the sourcecode is different form the original version. I follow the instructions of right clicking on location but, the error still exists.
Why is this happening, and how can we fix this?
Thanks a lot!
Make sure that the controller is named UserSesionManagerController and not only UserSesionManager:
public class UserSesionManagerController: Controller
{
...
[HttpPost]
public ActionResult GetStatTypesDistribution(FormCollection form)
{
...
}
}
Also make sure that you have a default route in global.asax:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Rebuild your solution. Stop the web server you are using for debugging and check to ensure if you are using the built in web server (Cassini) it's not running in the system tray.
F5 in visual studio to debug. If you still get the error load up the modules window from debug menu then modules. Find your code listed in there an look where it's loaded from.
If it's still an issue delete the apps folder from the temporary asp.net files folder and try debugging again but the modules window should give some info.

ASP.Net MVC 2 Forms Authentication cookieless = "UseUri" while submit authorization fails

I just started working with ASP.Net MVC 2.
I created a new ASP.Net MVC application and created one vehicle controler with a database table connected with LINQ. Then created forms authentication mechanism for the application and tried to use the uri instead of cookies it was working smoothly but when i submit the form by creating a "Create" view from the controler using the utility it just dont work. The autherization got failed and asking to enter the user name and password again.I had created the authorization mechanism by adding Authorise attribute to the Controller so as to get authorized for all the actions.
namespace MVCNEW.Controllers
{
[Authorize]
public class VehicleController : Controller
{
But if i use the cookies instead of uri it works fine.
Thanks in advance...
Please see http://forums.asp.net/p/1517391/3634908.aspx for an official response.
Summary: Cookieless Session support is essentially obsolete, and the MVC framework isn't likely to include additional support for it.
I found the problem and a solution.
This was due to some error in the framework. They are not creating the Uri string for the Form action while calling
Html.BeginForm()
But if we make it call overloading of this method like the providing the Controller name and Action name it is working fine.
view plaincopy to clipboardprint?
Html.BeginForm("Create","Vehicle")