Hi Guys,
Relatively new to ASP.NET MVC and little confused about how to do routing. My problem basically relates to "logged in" and "logged out routes" and having both as "/".
i.e. I have home/index for logged out user which appears as "/" but this has got me confused as to how I can have home/home for logged in user and still have "/".
I keep getting 127.0.0.1/home/home
I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/index.
Does anyone know how I can modify the routes dictionary (which will be binded ONCE at the start) so that the "/" can be shared for logged and non-logged users ?
Thanks?
I have a page with a menu that uses JQuery AJAX calls to populate the page with. To reflect any changes I update the URL with a #... instead of ?... or /... So an URL that originally reads : htpp://localhost/pages/index/id=1 would look like : http://localhost/#pages/index/id=1. If a user bookmarks this, and later comes back to the page, I wonder if it's possible to use the second URL in my route decoding, or if I have to load it blank, then use the same JS/Ajax to populate the page?
In my mind it is problematic to use Ajax in these cases if a user copies the link and mails it to a friend with JavaScript disabled.
edit#1: Fixed some spelling.
I'm using Lotus Notes 8.5.2 in a large corporate deployment. I'm trying to figure out how to search my email in a structured manner, e.g. by specifying criteria on fields.
The help seems to suggest that I can use fields in square brackets and a list of operators, e.g. to find all mail where the From field contains John, I'd search for
/[From] CONTAINS John
However, I can't get this to work - any operator style query I've tried returns zero documents. "Web-style" queries (e.g. typing John into the search dialog) work, but I'd really prefer a way that would let me search more precisely.
Potential issues:
I'm assuming that the field names can be taken from the list of things I see when I open a mail and look at its Document Properties.
Full text indexing is turned off for my mailbox, and all my attempts to create my own have failed.
Does anyone have better information on searching by from/date/subject conditions in Notes?
Using PHP: How can I create an image to display an email address (to help reduce spam)?
Meaning, if I want to display "[email protected]" on my web page, since crawlers can easily find that text - I want to display the email address as an image that says "[email protected]".
How do I do that? I want the font to be:
color: #20c
font: 11px normal tahoma
I have recently setup Exhchange Server 2007. The server is smarthosting outgoing messages. Users have 'request delivery receipt' on by default their 'auditing' purposes in Outlook. They would like the original email attached to the delivery notification as was the case in Exchange Server 2003. I need this same functionality in 2007. The question has been asked here, here and here but cannot find a valid solution.
Here's some information about the functionality in Exchange 2003.
The question is, can i replication this functionality in 2007?
Here is what a 2007 delivery message looks like:
I know it's possible to customize DSN's. Can I make a custom DSN for this type of message and have the original included as an attachment?
Anyone got any other ideas?
Hi guys,
This is my first post after being a long-time lurker - so please be gentle :-)
I have a website similar to twitter, in that people can sign up and choose a 'friendly url', so on my site they would have something like:
mydomain.com/benjones
I also have root level static pages such as:
mydomain.com/about
and of course my homepage:
mydomain.com/
I'm new to ASP.NET MVC 2 (in fact I just started today) and I've set up the following routes to try and achieve the above.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("content/{*pathInfo}");
routes.IgnoreRoute("images/{*pathInfo}");
routes.MapRoute("About", "about",
new { controller = "Common", action = "About" }
);
// User profile sits at root level so check for this before displaying the homepage
routes.MapRoute("UserProfile", "{url}",
new { controller = "User", action = "Profile", url = "" }
);
routes.MapRoute("Home", "",
new { controller = "Home", action = "Index", id = "" }
);
}
For the most part this works fine, however, my homepage is not being triggered! Essentially, when you browser to mydomain.com, it seems to trigger the User Profile route with an empty {url} parameter and so the homepage is never reached! Any ideas on how I can show the homepage?
I have tried to embed the icalendar code in a email to be sent via indy with a content type text/calendar but it just hangs on the encoding of the email when I add as an attachment it just arrives as an attachment and does not prompt as other calendar request do. Has any one got example code of how to do calendar requests via indy?
I'm developing an MVC framework in PHP from scratch; mostly for the learning experience but this could easily end up in a live project. I went through this tutorial as a base and I've expanded from there.
Requests are made like this:
examplesite.com/controller/action/param1/param2/ and so on...
And this is my .htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
So all requests go to index.php and they are routed to the correct controller and action from there. If no controller or action is given, then the default 'index' is assumed for both.
I have an index controller with an index action, which is supposed to be the home page of my site. I can access it by going to examplesite.com (since the index part is assumed). It has some images, a link to a stylesheet, and some scripts. They are linked with paths relative to index.php. I thought this would be fine since all request go to index.php and all content is simply included in this page using php. This works if I go to examplesite.com. I will see all of the images and styles, and scripts will run.
However, if I go to examplesite.com/index, I am routed to the correct part of the site, but all of the links don't work. Does the browser think I am in a different folder?
I would like to be able to use relative paths for all of the content in my site, because otherwise I need to use absolute paths everywhere to make sure things will show up. Is this possible?
Hi folks, i have an urgent problem. Essentially, my routing works on my localhost. But when i deployed this to production, the routes does not seem to work correctly.
For example, given a new route "/invites" - sometimes i will get a 404, and sometimes it will work correctly.
I suspect there is some caching going on somewhere, but i am not sure.
Can someone help?
UPDATE: when a page is not found (when it is supposed to be ok )
Processing UsersController#network
(for 67.180.78.126 at 2010-06-01
09:59:31) [GET] Parameters:
{"id"="new"}
ActionController::RoutingError (No
route matches
"/comm/role_playing_games" with {}):
app/controllers/application_controller.rb:383:in
prev_page_label'
app/controllers/application_controller.rb:238:in
log_timed_info'
app/controllers/users_controller.rb:155:in
network'
app/controllers/users_controller.rb:151:in
network'
app/controllers/application_controller.rb:44:in
turn_on_query_caching'
app/controllers/application_controller.rb:43:in
turn_on_query_caching'
app/controllers/application_controller.rb:42:in
turn_on_query_caching'
app/controllers/application_controller.rb:41:in
turn_on_query_caching'
app/controllers/application_controller.rb:40:in
turn_on_query_caching'
app/controllers/application_controller.rb:39:in
turn_on_query_caching' haml (3.0.6)
lib/sass/plugin/rack.rb:41:in `call'
Rendering
/mnt/app/releases/20100524233313/public/404.html
(404 Not Found)
hii
every one,
I m creating an project
in which Admin is one user
I want code or any idea how can Admin send a quotation of any type of products to his
customer though email on their email ID
and this quotation has to be a print option button
bec. after clicking on print button quotation should be print
How can i do it?
In rails, on can show the active routes with rake (http://guides.rubyonrails.org/routing.html):
$ rake routes
users GET /users {:controller=>"users", :action=>"index"}
formatted_users GET /users.:format {:controller=>"users", :action=>"index"}
POST /users {:controller=>"users", :action=>"create"}
POST /users.:format {:controller=>"users", :action=>"create"}
Is there a similar tool/command for django showing the e.g. the URL pattern, the name of the pattern (if any) and the associated function in the views?
When i right click an email in Outlook 2007, it always defaults or opens to be saved in one particular folder. It's always the same folder. Actually a subfolder in a folder. It never used to do this. It would always default to the last folder that I had saved in before . Does anyone know how to stop this from happening?
It is getting really time consuming and irritating. Would a windows update affect this?
I have a dashboard with a series of widgets. Per specification, the widgets need to be buried under a /widgets/ directory.
So I have added the following to my routes.php
Router::connect('/widget/:controller/:action/*', array());
But I seem to be running into trouble on widgets/links/ and widgets/links/view/1
I am new to CakePHP, but this doesn't seem all that impressive. I have yet to find anything in the Book or by search. So any help is appreciated.
Thanks.
My send mail task works fine for email ids like [email protected] but it throws error for email ids like [email protected].
is there any way i can make it work for such ids also?
Thanks.
When users subscribe to the newsletter on A Magento Store they receive a confirmation email. Is it possible to prevent this email from being sent?
There doesn't seem to be an option in the back end for this.
<%= link_to t('.new', :default => t("helpers.links.new")), new_equipment_path, :class => 'btn btn-primary' %>
I have the above code in a view, but am getting the following error when clicking the link: No route matches {:action=>"show", :controller=>"equipment"}
My routes file contains:
devise_for :users
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
resources :equipment
resources :workouts
root :to => "home#index"
match 'workouts/random', :to => 'workouts#random'
match ':controller(/:action(/:id))(.:format)'
Why is it trying to access the show action?
I've got a big piece of scientific equipment which is hooked up to, and controlled by software running on a Windows PC. Unfortunately the software, provided by the manufacturer, crashes occasionally when nobody is there to watch it. We'd really like a piece of software which could watch the application, and when it crashes, send out an email right away. Is there anything out there like that?
EDIT: we want to monitor the application, which is a normal piece of Windows software, running on the PC. The mention of the equipment was just sort of background to explain why we cared.
Is it possible to host 2 asp.net projects off one ip address? I don't have a domain name just an ip number. I'm running IIS7.
The first project runs and displays fine over the web by simply typing in the ip address into the browser but I'm having trouble accessing the second.
Currently both projects have virtual directories in IIS7.
Help is greatly appreciated.
Thx
I'm using routing in asp.net to get nice URLs
When I define routes in global.asax I create two distinct routes that use the same controller (c#):
// Setup code for route a...
routes.Add("routeb", routea);
// Setup code for route b...
routes.Add("routeb", routeb);
(How) is it possible to determine from within the controller what the "key" value is that directed the user to this controller? Alternatively is the pattern of use wrong - it would be straightforward to subclass the Controller (again) to distinguish between the two and retain common code if that is a more appropriate solution.
I have a simple SEO task. There's a City model and a Brand model, and I have to create 1st-level URLs for both (e.g. site.com/honda and site.com/boston).
What's the preferred routing/controller combination to do this in Rails? I can only think of
map.connect '/:id', :controller => 'catchall', :action => 'index'
class CatchallController < ApplicationController
def index
if City.exists?(:slug => params[:id])
@city = City.find_by_slug!(params[:id])
render 'cities/show'
else
@brand = Brand.find_by_slug!(params[:id])
render 'brands/show'
end
end
end
but it seems to be very un-Rails to put such logic into the controller.
(Obviously I need to make sure that the slugs don't overlap in the models, that's done).
My issue is that I customer Map Route in MVC which takes three parameters. When I supply all three or just two, the parameters are passed from the URL to my controller. However, when I only supply the first parameter, it is not passed and returns null. Not sure what causes this behavior.
Route:
routes.MapRoute(
name: "Details", // Route name
url: "{controller}/{action}/{param1}/{param2}/{param3}", // URL with parameters
defaults: new { controller = "Details", action = "Index", param1 = UrlParameter.Optional, param2 = UrlParameter.Optional, param3 = UrlParameter.Optional } // Parameter defaults
);
Controller:
public ActionResult Map(string param1, string param2, string param3)
{
StoreMap makeMap = new StoreMap();
var storemap = makeMap.makeStoreMap(param1, param2, param3);
var model = storemap;
return View(model);
}
string param1 returns null when I navigate to:
/StoreMap/Map/PARAM1NAME
but it doesn't return null when I navigate to:
/StoreMap/Map/PARAM1NAME/PARAM2NAME
So I've got a Users controller, and it has (amongst others) a function called details.
The idea is that a user can go to
localhost:3000/user/:user_id/details
and be able to view the details of :user_id.
For example, I have a user called "tester".
When I go to the uri: http://localhost:3000/users/tester/details
I'd want the details function to be called up, to render the details view, and to display the information for the user tester.
But instead I get an error saying that
No action responded to tester. Actions: change_password, create, current_user, details, forgot_password, index, login_required, new, redirect_to_stored, show, and update_attributes
And I understand that to basically mean that if I wanted to access details, I should really be using
http://localhost:3000/users/details
Except that that isn't really working either... .<
That is instead bringing me to http://localhost:3000/users/details/registries
(which is the default path that I'd stipulated for anybody trying to view users/:user_id, so again, that's working the way I wanted it to)
Point is: Can anybody help and tell me how I can go about getting
users/:user_id/details to work the way I want it to and display the details of :user_id?
Thanks!
This is my situation:
I work as a consultant, and thus work out of multiple computers:
my work-laptop
a desktop at my primary client
my desktop at home
an android smartphone
an android tablet
Likewise, I have multiple accounts:
A Microsoft Exchange (2010 AFAIK) account
A Microsoft Exchange (2007 AFAIK) account
A gmail account
The most important thing I need is the ability to have events in one calendar affect the free / busy status of all other accounts (so that if I am busy on Monday 9am with an event from my employer's account, it will show that time as busy in my client's account, and in the gmail account.
Second thing I need is a unified view of all of my accounts' info: Appointments, email, tasks, and contacts (in that order of importance).
I've already tried outlook synchronization tools such as gSyncit, to sync both exchange accounts with gmail, but this creates a mess when updating appointments (deleted appointments sometimes return, timestamps revert).
Is there perhaps some way to at least synchronize the free/busy state in a way that all of my calendar apps / accounts will look there to see if I can be invited? Just solving that would be well worth my while.
Thanks,
Assaf
Hi I've just started learning rails and been going through some tutorials from learning rails (http://www.buildingwebapps.com/podcasts/79335-putting-the-page-contents-into-the)
The tutorials appear to be Rails v2 and I'm on Rails v3
There is a line in the routes file which appears to be causing a problem
map.view_page ':name', :controller => 'viewer', :action => 'show'
The line works for the front end view i.e. my viewer controller but not for the back end
I get the error
NoMethodError in Viewer#show
I think this has something to do with the view I am using and the line
<%= @page.body %>
I know it's difficult without the full code but if anyone can help that would be awesome