Search Results

Search found 19374 results on 775 pages for 'url modification'.

Page 86/775 | < Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >

  • Built in method to encode ampersands in urls returned from Url.Action?

    - by Blegger
    I am using Url.Action to generate a URL with two query parameters on a site that has a doctype of XHTML strict. Url.Action("ActionName", "ControllerName", new { paramA="1" paramB="2" }) generates: /ControllerName/ActionName/?paramA=1&paramB=2 but I need it to generate the url with the ampersand escaped: /ControllerName/ActionName/?paramA=1&amp;paramB=2 The fact that Url.Action is returning the URL with the ampersand not escaped breaks my HTML validation. My current solution is to just manually replace ampersand in the URL returned from Url.Action with an escaped ampersand. Is there a built in or better solution to this problem?

    Read the article

  • Unittesting Url.Action (using Rhino Mocks?)

    - by Kristoffer Ahl
    I'm trying to write a test for an UrlHelper extensionmethod that is used like this: Url.Action<TestController>(x => x.TestAction()); However, I can't seem set it up correctly so that I can create a new UrlHelper and then assert that the returned url was the expected one. This is what I've got but I'm open to anything that does not involve mocking as well. ;O) [Test] public void Should_return_Test_slash_TestAction() { // Arrange RouteTable.Routes.Add("TestRoute", new Route("{controller}/{action}", new MvcRouteHandler())); var mocks = new MockRepository(); var context = mocks.FakeHttpContext(); // the extension from hanselman var helper = new UrlHelper(new RequestContext(context, new RouteData()), RouteTable.Routes); // Act var result = helper.Action<TestController>(x => x.TestAction()); // Assert Assert.That(result, Is.EqualTo("Test/TestAction")); } I tried changing it to urlHelper.Action("Test", "TestAction") but it will fail anyway so I know it is not my extensionmethod that is not working. NUnit returns: NUnit.Framework.AssertionException: Expected string length 15 but was 0. Strings differ at index 0. Expected: "Test/TestAction" But was: <string.Empty> I have verified that the route is registered and working and I am using Hanselmans extension for creating a fake HttpContext. Here's what my UrlHelper extentionmethod look like: public static string Action<TController>(this UrlHelper urlHelper, Expression<Func<TController, object>> actionExpression) where TController : Controller { var controllerName = typeof(TController).GetControllerName(); var actionName = actionExpression.GetActionName(); return urlHelper.Action(actionName, controllerName); } public static string GetControllerName(this Type controllerType) { return controllerType.Name.Replace("Controller", string.Empty); } public static string GetActionName(this LambdaExpression actionExpression) { return ((MethodCallExpression)actionExpression.Body).Method.Name; } Any ideas on what I am missing to get it working??? / Kristoffer

    Read the article

  • Codeigniter: Base_url doesn't seem to be working

    - by Dwayne
    I have developed a simple site that fetches tweets from the Twitter public timeline, caches them for 60 seconds and so on. I have recently moved hosts from Hostgator to Mediatemple and my site was previously working fine on Hostgator. My application doesn't use a database connection, nor does it use any form of flat-file database either. Tweets are cached in an XML file stored in the root directory, not that most of that is important. The url helper is being included as can be seen below (this is my helpers line from autoload.php): $autoload['helper'] = array('url'); I have also removed my index.php file from the URL using .htaccess directives and once again this was previously working on Hostgator (see my .htaccess code below): RewriteEngine On RewriteRule ^(application) - [F,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L] In my home.php view file which is in the views folder inside of application, I am using the function base_url() which was previously working on Hostgator inside of my view files and appending it a base href value in my header: <base href="<?php echo base_url(); ?>" /> Here is what my base_url value looks like in the config.php file: $config['base_url'] = "http://threetune.com/"; Although what appears to be happening is that the base_url is not to be seen at all. It doesn't appear to be echoing out the value of base_url as it appears to be empty for some reason. What makes things weirder is that I have a link in another view file called 'fetch.php' and for some reason it appears to be stripping out the value (XSS filtering is off): <a href="threetune/show"><img src="assets/images/cookie.jpg" /></a> The threetune/show part is not to be seen and I only see an empty href value like this <a href=""><img src="assets/images/cookie.jpg" /></a> Can anyone possibly see anything wrong that I may have done, some kind of Mediatemple server limitation or PHP.ini flag that needs to be set? Thank you and I hope I was descriptive enough.

    Read the article

  • MVC: capture route url's and pass them to javascript function

    - by Tim Geerts
    Short:Is there a way to have a route-definition that will pass the "CONTROLLER/ACTION" string value to a javascript function in stead of actually going straight for the controller action? More:I have a masterpage which contains the navigation of the site. Now, all the pages need this navigation wrapped around it at all times, but because I didn't want the navigation to constantly load with each pagecall, I changed all my pages to partialviews. These partial views are loaded via the JQuery.Load() method whenever a menu item is clicked in the navigation. This all worked very good, up till now because I noticed it's also a requirement of the website to be able to link directly to page X, rather then default.aspx. So, as an example:The main page is my "default.aspx" page, this utilizes my master page with the nagivation around it. And each call to a new page uses a javascript function that loads that particular partial view inside a div that is known in my masterpage. So, the url never changes away from "default.aspx", but my content changes seemlesly. The problem is, those url's also need to be available when typed directly into the address bar. But, they're partial views, so loading them directly from the address bar makes them display without any masterpages around them. Therefore my question if it might be possible to capture the route typed into the address bar and pass that on to my javascript function that will load that route in the content div. (I hope I explained it ok enough, if not, feel free to ask more information)

    Read the article

  • How do I add a URL parameter to redirected login page using JSF 2.0

    - by Big Al
    I have a question about session timeouts and JSF 2. I have my exception handler working exactly the way everyone prefers but I need to pass a value to the login page. For example, I have a typical login URL - www.acme.com/?companyId=company14 which in turn presents company14 with their own custom login page (using their logo). After they enter the application and do a bit of work, they read an email or 2. The session times out and a session timeout page is shown instructing the user to click Ok to proceed to the login page. How do I add ?companyId=company14 to the URL? I can hardcode it in the exception handler by using this: requestMap.put("companyId", "company14"); and then referring to it on the viewExpired.xhtml page: <h:panelGrid id="expiredGrid" columns="1"> <f:facet name="header"> <h:outputText id="outExpireMsg" value="Your session has expired"/> </f:facet> <h:outputText id="outReqMessage" value="Reloading the page will require login."/> <h:outputText value=""/> <h:button id="okButton" type="submit" value="Ok" outcome="login?companyId=#{companyId}"/> </h:panelGrid> The issue is I can't seem to save the companyId anywhere without it getting wiped out by the session timeout. I'd like to set the companyId in the exceptionhandler using this value. Any ideas?

    Read the article

  • url rewrite & redirect question

    - by Shawn
    Say currently I have url like : http://mydomain.com/showpost.php?p=123 Now I want to make it prettier : http://mydomain.com/123/post-title I'm using apache rewrite which grabs segment '123' and put the url back to http://mydomain.com/showpost.php?p=123 OK. Here is the problem. I want to redirect the original non-pretty urls which were indexed by Google to the pretty versions, I want this because I heard that Google may punish me if he sees multiple urls pointing to identical content. So I need to redirect /showpost.php?p=123 to /123/post-title This I have to do in my php code coz there's no way Apache to be able to figure out the 'post-title', but if I put the redirect code in php code, then it will be a infinite loop, such as : Request : /showpost.php?p=123 redirected to : /123/post-title rewritten to: /showpost.php?p=123 redirected again to : /123/post-title ... So on and so forth. Sorry I should Google the solution first but I really don't know how to describe my situation in English to make Google return reasonable results. Please help me. Thanks.

    Read the article

  • sending HTML email with a variable in the URL

    - by Rob Crouch
    I am using the following script to send a dynamic page (php) as a html email... the page being emailed uses a variable in the URL to determine what record is shown from a database <? $evid = $_GET['evid']; $to = '[email protected]'; $subject = 'A test email!'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Put your HTML here $message = file_get_contents('http://www.url.co.uk/diary/i.php?evid=2'); // Mail it mail($to, $subject, $message, $headers); ?> as you can see the html file being emailed has a evid variable... if i set this to $evid and try to send the variable when running the current script I get an error... does anyone know of a way round this? hope i explained that clear enough Rob

    Read the article

  • How to Persist URL parameters when CakePHP form validation fails

    - by am2605
    Hi, I'm new to cakephp and trying to write a simple app with it, however I'm stuck with some form validation issues. I have a model named "Person" which hasMany "PersonSkill" objects. To add a "PersonSkill" to a person, I have set it up to call a url like this: http://localhost/myapp/person_skills/add/person_id:3 I have been passing through the person_id because I want to display the name of the person we are adding the skills for. My issue is if the validation fails, the person_id parameter is not persisted to the next request, so the person's name is not displayed. The add method on the controller looks like this: function add() { if (!empty($this->data)) { if ($this->PersonSkill->save($this->data)) { $this->Session->setFlash('Your person has been saved.'); $this->redirect(array('action' => 'view', 'id' => $this->PersonSkill->id)); } } else { $this->Person->id = $this->params['named']['person_id']; $this->set('person', $this->Person->read()); } } In my person_skill add.ctp I set a hidden field which holds the person_id, eg: echo $form->input('person_id', array('type'=>'hidden','value'=>$person['Person']['id'])); Is there a way to persist the person_id url parameter when form validation fails, or is there a better way to do this that I'm missing completely? Any advice would be greatly appreciated.

    Read the article

  • Django: Serving Media Behind Custom URL

    - by TheLizardKing
    So I of course know that serving static files through Django will send you straight to hell but I am confused on how to use a custom url to mask the true location of the file using Django. http://stackoverflow.com/questions/2681338/django-serving-a-download-in-a-generic-view but the answer I accepted seems to be the "wrong" way of doing things. urls.py: url(r'^song/(?P<song_id>\d+)/download/$', song_download, name='song_download'), views.py: def song_download(request, song_id): song = Song.objects.get(id=song_id) fsock = open(os.path.join(song.path, song.filename)) response = HttpResponse(fsock, mimetype='audio/mpeg') response['Content-Disposition'] = "attachment; filename=%s - %s.mp3" % (song.artist, song.title) return response This solution works perfectly but not perfectly enough it turns out. How can I avoid having a direct link to the mp3 while still serving through nginx/apache? EDIT 1 - ADDITIONAL INFO Currently I can get my files by using an address such as: http://www.example.com/music/song/1692/download/ But the above mentioned method is the devil's work. How can I accomplished what I get above while still making nginx/apache serve the media? Is this something that should be done at the webserver level? Some crazy mod_rewrite? http://static.example.com/music/Aphex%20Twin%20-%20Richard%20D.%20James%20(V0)/10%20Logon-Rock%20Witch.mp3

    Read the article

  • Facebook og:url ignored in favour of a Facebook hosted page about the og entity

    - by Dan
    I am trying to implement the Like button on my pages. Those pages represent the review page for a product. When a user Likes the page, it shows up in Facebook (not as a link, but as liking an entity), however when you click on the entity in Facebook it links through to a facebook.com hosted page representing the page. I want the user to be redirected to the og:url page? This happens for example when you Like an artist page on Grroveshar: http://grooveshark.com/#!/artist/Elbow/4795 I am clearly "doing it wrong". I am using the following markup to include the SDK. MYAPPID is included by the code generator Facebook provides so I assume it is required. <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=MYAPPID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Then my code to render the Like button. <div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div> And finally my og tags: <meta property="og:title" content="My product" /> <meta property="og:type" content="product" /> <meta property="og:url" content="http://site.com/product_1/" /> <meta property="og:image" content="http://site.com/image1.jpg" /> <meta property="og:site_name" content="My-Site-Name.com" /> <meta property="fb:admins" content="MYFACEBOOKID" /> <meta property="fb:app_id" content="MYAPPID" /> Thanks!

    Read the article

  • VBScript: Disable caching of response from server to HTTP GET URL request

    - by Rob
    I want to turn off the cache used when a URL call to a server is made from VBScript running within an application on a Windows machine. What function/method/object do I use to do this? When the call is made for the first time, my Linux based Apache server returns a response back from the CGI Perl script that it is running. However, subsequent runs of the script seem to be using the same response as for the first time, so the data is being cached somewhere. My server logs confirm that the server is not being called in those subsequent times, only in the first time. This is what I am doing. I am using the following code from within a commercial application (don't wish to mention this application, probably not relevant to my problem): With CreateObject("MSXML2.XMLHTTP") .open "GET", "http://myserver/cgi-bin/nsr/nsr.cgi?aparam=1", False .send nsrresponse =.responseText End With Is there a function/method on the above object to turn off caching, or should I be calling a method/function to turn off the caching on a response object before making the URL? I looked here for a solution: http://msdn.microsoft.com/en-us/library/ms535874(VS.85).aspx - not quite helpful enough. And here: http://www.w3.org/TR/XMLHttpRequest/ - very unfriendly and hard to read. I am also trying to force not using the cache using http header settings and html document header meta data: Snippet of server-side Perl CGI script that returns the response back to the calling client, set expiry to 0. print $httpGetCGIRequest-header( -type = 'text/html', -expires = '+0s', ); Http header settings in response sent back to client: <html><head><meta http-equiv="CACHE-CONTROL" content="NO-CACHE"></head> <body> response message generated from server </body> </html> The above http header and html document head settings haven't worked, hence my question.

    Read the article

  • Image URL not changing in Update panel

    - by Chiefy
    Ok this is probably really simple but I have been staring at it for too long now. I have an AJAX AsyncFileUpload control that when a file is selected I want the Image next to it to change. I tried it in Javascript and it did nothing, i have since tried it server-side and still nothing. here is the client side. <asp:UpdatePanel runat="server" ID="upnlConfidential"> <ContentTemplate> <td> <asp:AsyncFileUpload ID="_flupCV" runat="server" OnUploadedComplete="AdminFileUpload" /> </td> <td> <asp:Image ID="imgCV" runat="server" Height="25px" Width="25px" ImageUrl="~/Images/Exclamation.png"/> </td> </ContentTemplate> </asp:UpdatePanel> and here is the server side protected void AdminFileUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) { AjaxControlToolkit.AsyncFileUpload upload = (AjaxControlToolkit.AsyncFileUpload)sender; if (upload.PostedFile != null) { switch (upload.ID) { case "_flupCV": ImageCheckMark(imgCV); break; //etc... } } } private void ImageCheckMark(Image image) { image.Visible = true; image.ImageUrl = "~/Images/CheckMark.png"; } When the server side is called it sets the URL just fine but then nothing happens to the image, when I call the code again the URL is still the previous Exclamation image. its almost like its forgotten. Can anybody help me on this please. Thanks in advance to all who contribute!

    Read the article

  • Amazon access key showing in URL for Carrierwave and Fog

    - by kcurtin
    I just switched from storing my images uploaded via Carrierwave locally to using Amazon s3 via the fog gem in my Rails 3.1 app. While images are being added, when I click on an image in my application, the URL is providing my access key and a signature. Here is a sample URL (XXX replaced the string with the info): https://s3.amazonaws.com/bucketname/uploads/photo/image/2/IMG_4842.jpg?AWSAccessKeyId=XXX&Signature=XXX%3D&Expires=1332093418 This is happening in development (localhost:3000) and when I am using heroku for production. Here is my uploader: class ImageUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick storage :fog def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end process :convert => :jpg process :resize_to_limit => [640, 640] version :thumb do process :convert => :jpg process :resize_to_fill => [280, 205] end version :avatar do process :convert => :jpg process :resize_to_fill => [120, 120] end end And my config/initializers/fog.rb : CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => 'XXX', :aws_secret_access_key => 'XXX', } config.fog_directory = 'bucketname' config.fog_public = false end Anyone know how to make sure this information isn't available?

    Read the article

  • What should the standard be for ReSTful URLS?

    - by gargantaun
    Since I can't find a chuffing job, I've been reading up on ReST and creating web services. The way I've interpreted it, the future is all about creating a web service for all your data before you build the web app. Which seems like a good idea. However, there seems to be a lot of contradictory thoughts on what the best scheme is for ReSTful URLs. Some people advocate simple pretty urls http://api.myapp.com/resource/1 In addition, some people like to add the API version to the url like so http://api.myapp.com/v1/resource/1 And to make things even more confusing, some people advocate adding the content-type to get requests http://api.myapp.com/v1/resource/1.xml http://api.myapp.com/v1/resource/1.json http://api.myapp.com/v1/resource/1.txt Whereas others think the content-type should be sent in the HTTP header. Soooooooo.... That's a lot of variation, which has left me unsure of what the best URL scheme is. I personally see the merits of the most comprehensive URL that includes a version number, resource locator and content-type, but I'm new to this so I could be wrong. On the other hand, you could argue that you should do "whatever works best for you". But that doesn't really fit with the ReST mentality as far as I can tell since the aim is to have a standard. And since a lot of you people will have more experience than me with ReST, I thought I'd ask for some guidance. So, with all that in mind... What should the standard be for ReSTful URLS?

    Read the article

  • Twitter O-Auth Callback url

    - by jtymann
    I am having a problem with Twitter's oauth authentication and using a callback url. I am coding in php and using the sample code referenced by the twitter wiki, http://github.com/abraham/twitteroauth I got that code, and tried a simple test and it worked nicely. However I want to programatically specify the callback url, and the example did not support that. So I quickly modified the getRequestToken() method to take in a parameter and now it looks like this: function getRequestToken($params = array()) { $r = $this->oAuthRequest($this->requestTokenURL(), $params); $token = $this->oAuthParseResponse($r); $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); return $token; } and my call looks like this $tok = $to->getRequestToken(array('oauth_callback' => 'http://127.0.0.1/twitter_prompt/index.php')); This is the only change I made, and the redirect works like a charm, however I am getting an error when I then try and use my newly granted access to try and make a call. I get a "Could not authenticate you" error. Also the application never actually gets added to the users authorized connections. Now I read the specs and I thought all I had to do was specify the parameter when getting the request token. Could someone a little more seasoned in oauth and twitter possibly give me a hand? Thank You

    Read the article

  • Rails form with a better URL

    - by Sam
    Wow, switching to REST is a different paradigm for sure and is mainly a headache right now. view <% form_tag (businesses_path, :method => "get") do %> <%= select_tag :business_category_id, options_for_select(@business_categories.collect {|bc| [bc.name, bc.id ]}.insert(0, ["All Containers", 0]), which_business_category(@business_category) ), { :onchange => "this.form.submit();"} %> <% end %> controller def index @business_categories = BusinessCategory.find(:all) if params[:business_category_id].to_i != 0 @business_category = BusinessCategory.find(params[:business_category_id]) @businesses = @business_category.businesses else @businesses = Business.all end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @businesses } end end routes map.resources What I want to to is get a better URL than what this form is presenting which is the following: http://localhost:3000/businesses?business_category_id=1 Without REST I would have do something like http://localhost:3000/business/view/bbq bbq as permalink or I would have done http://localhost:300/business_categories/view/bbq and get the business that are associated with the category but I don't really know the best way of doing this. So the two questions are what is the best logic of finding a business by its categories using the latter form and number two how to get that in a pretty URL all through RESTful routes in Rails.

    Read the article

  • Webfaction apache + mod_wsgi + django configuration issue

    - by Dmitry Guyvoronsky
    A problem that I stumbled upon recently, and, even though I solved it, I would like to hear your opinion of what correct/simple/adopted solution would be. I'm developing website using Django + python. When I run it on local machine with "python manage.py runserver", local address is http://127.0.0.1:8000/ by default. However, on production server my app has other url, with path - like "http://server.name/myproj/" I need to generate and use permanent urls. If I'm using {% url view params %}, I'm getting paths that are relative to / , since my urls.py contains this urlpatterns = patterns('', (r'^(\d+)?$', 'myproj.myapp.views.index'), (r'^img/(.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/img' }), (r'^css/(.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css' }), ) So far, I see 2 solutions: modify urls.py, include '/myproj/' in case of production run use request.build_absolute_uri() for creating link in views.py or pass some variable with 'hostname:port/path' in templates Are there prettier ways to deal with this problem? Thank you. Update: Well, the problem seems to be not in django, but in webfaction way to configure wsgi. Apache configuration for application with URL "hostname.com/myapp" contains the following line WSGIScriptAlias / /home/dreamiurg/webapps/pinfont/myproject.wsgi So, SCRIPT_NAME is empty, and the only solution I see is to get to mod_python or serve my application from root. Any ideas?

    Read the article

  • Trouble with Router::url() when using named parameters

    - by sibidiba
    I'm generating plain simple links with CakePHP's HtmlHelper the following way: $html->link("Newest", array( 'controller' => 'posts', 'action' => 'listView', 'page'=> 1, 'sort'=>'Question.created', 'direction'=>'desc', )); Having the following route rule: Router::connect('/foobar/*',array( 'controller' => 'posts', 'action' => 'listView' )); The link is nicely generated as /foobar/page:1/sort:Question.created/direction:desc. Just as I want, it uses my URL prefix instead of controller/action names. However, for some links I must add named parameters like this: $html->link("Newest", array( 'controller' => 'posts', 'action' => 'listView', 'page'=> 1, 'sort'=>'Question.created', 'direction'=>'desc', 'namedParameter' => 'namedParameterValue' )); The link in this case points to /posts/listView/page:1/sort:Question.created/direction:desc/namedParameter:namedParameterValue. But I do not want to have contoller/action names in my URL-s, why is Cake ignoring in this case my routers configuration?

    Read the article

  • relative url in wcf service binding

    - by Jeremy
    I have a silverlight control which has a reference to a silverlight enabled wcf service. When I add a reference to the service in my silverlight control, it adds the following to my clientconfig file: <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_DataAccess" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:3097/MyApp/DataAccess.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_DataAccess" contract="svcMyService.DataAccess" name="BasicHttpBinding_DataAccess" /> </client> </system.serviceModel> </configuration> How do I specify a relative url in the endpoint address instead of the absolute url? I want it to work no matter where I deploy the web app to without having to edit the clientconfig file, because the silverlight component and the web app will always be deployed together. I thought I'd be able to specify just "DataAccess.svc" but it doesn't seem to like that.

    Read the article

  • routing mvc on the web

    - by generic_noob
    Hi, I was wondering if anyone could possibly provide me some advice on how i could improve the routing (and/or architecture) to each 'section' of my application. (I'm writing in PHP5, and trying to use strict MVC) Basically, I have a generic index page for the app, and that will spew out boilerplate stuff like jquery and the css etc. and it also generates the main navidation for the entire site, but i'm unsure about the best approach to connect the 'main menu' items(hyperlinks) with their associated controllers. Up until now I have been appending strings into the url and using a 'switch' statement to branch to the correct controller(and view) by extracting the strings back out of '$GET[]' to let it execute the code for the corrosponding action. for instance if i had a basic crud system for customer data, the url to edit a customers details would look like 'www.example.com/index.php?page=customer&action=edit&id=4'. I'm worried that there is a security concern by doing it this way, and i'm not sure of an alternative to branch the main 'index.php' file to the correct controller for each action once the user has clicked the link. Would it be better to use mod_rewrite to disguise the controllers names? or to create a similar system to the ASP MVC framework, where there is a seperate routing system where each url is filtered to get the associated controller? Cheers!

    Read the article

  • ASP.NET MVC URL Routing problem

    - by Sadegh
    hi, i have defined a route as below: context.MapRoute("SearchEngineWebSearch", "search/web/{query}/{index}/{size}", new { controller = "search", action = "web", query = "", index = 0, size = 5 }); and action method to handle request match with that: public System.Web.Mvc.ActionResult Web(string query = "", int index = 0, int size = 5) { if (string.IsNullOrEmpty(query)) return RedirectToRoute("SearchEngineBasicSearch"); var search = new Search(); var results = search.PerformSearch(query, index, size); ViewData["Query"] = query; if (results != null && results.Count() > 0) { ViewData["Results"]= results; return View("Web"); } else return View("Not-Found"); } and form to sent parameter to action method: <% using (Html.BeginForm("Web", "Search", FormMethod.Post)) { %> <input name="query" type="text" value="<%: ViewData["Query"]%>" class="search-field" /> <input type="submit" value="Search" class="search-button" /> <input type="hidden" name="index" value="2" /> <input type="hidden" name="size" value="2" /> <%} %> now after click on submit and sending value to action method all route values updated but url values still is equals to first time of sending parameter. for example if i sent for first time request such as http://localhost/search/web/google and for next time http://localhost/search/web/yahoo, query parameter which passed to action method is yahoo but url after postback is http://localhost/search/web/google still! can anybody help me plz? ;)

    Read the article

  • How can i fetch the large image from url

    - by Kutbi
    i used below code to fetch the image from url.but its not working for large image.. i missing something to add for that type of image to fetch. imgView = (ImageView)findViewById(R.id.ImageView01); imgView.setImageBitmap(loadBitmap("http://www.360technosoft.com/mx4.jpg")); //imgView.setImageBitmap(loadBitmap("http://sugardaddydiaries.com/wp-content/uploads/2010/12/how_do_i_get_sugar_daddy.jpg")); //setImageDrawable("http://sugardaddydiaries.com/wp-content/uploads/2010/12/holding-money-copy.jpg"); //Drawable drawable = LoadImageFromWebOperations("http://www.androidpeople.com/wp-content/uploads/2010/03/android.png"); //imgView.setImageDrawable(drawable); /* try { ImageView i = (ImageView)findViewById(R.id.ImageView01); Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://sugardaddydiaries.com/wp-content/uploads/2010/12/holding-money-copy.jpg").getContent()); i.setImageBitmap(bitmap); } catch (MalformedURLException e) { System.out.println("hello"); } catch (IOException e) { System.out.println("hello"); }*/ } protected Drawable ImageOperations(Context context, String string, String string2) { // TODO Auto-generated method stub try { InputStream is = (InputStream) this.fetch(string); Drawable d = Drawable.createFromStream(is, "src"); return d; } catch (MalformedURLException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } }

    Read the article

  • How to handle building and parsing HTTP URL's / URI's / paths in Perl

    - by Robert S. Barnes
    I have a wget like script which downloads a page and then retrieves all the files linked in img tags on that page. Given the URL of the original page and the the link extracted from the img tag in that page I need to build the URL for the image file I want to retrieve. Currently I use a function I wrote: sub build_url { my ( $base, $path ) = @_; # if the path is absolute just prepend the domain to it if ($path =~ /^\//) { ($base) = $base =~ /^(?:http:\/\/)?(\w+(?:\.\w+)+)/; return "$base$path"; } my @base = split '/', $base; my @path = split '/', $path; # remove a trailing filename pop @base if $base =~ /[[:alnum:]]+\/[\w\d]+\.[\w]+$/; # check for relative paths my $relcount = $path =~ /(\.\.\/)/g; while ( $relcount-- ) { pop @base; shift @path; } return join '/', @base, @path; } The thing is, I'm surely not the first person solving this problem, and in fact it's such a general problem that I assume there must be some better, more standard way of dealing with it, using either a core module or something from CPAN - although via a core module is preferable. I was thinking about File::Spec but wasn't sure if it has all the functionality I would need.

    Read the article

  • Apache friendly urls

    - by HaukurHaf
    Hi everyone. I've got a small CMS system written in PHP and running on Apache. The format of the URLs this CMS system uses/generates is: /display.php?PageID=xxx where xxx is just some integer number. As you can see, those URLs are not very friendly, neither for users nor search engines. I believe that using mod_rewrite (or something like that) and .htaccess files I should be able to configure Apache for URL-rewriting. I have searched for information about this before but I did not find any easy method to do this, it always involved messing with regular expressions, which I'm not very familiar with. Since the website in question is really simple and small, just 5-10 different pages, I would really like to be able to just hard-code the configuration, without any special rules or regexps. I'd just like to map a friendly URL to an actual URL, perhaps like this: /about = /display.php?PageID=44 /products = /display.php?PageID=34 etc. Is it possible to configure the mod_rewrite plugin in a basic way like this? Could someone explain the easiest method to do this? Explain it to me as if I was a child :-) Thanks in advance!

    Read the article

  • Re-authentication required for registered-path links (to ASP.NET site) coming to IE from PowerPoint

    - by Daniel Halsey
    We're using URL routing based on Phil Haack's example, with config modifications based on MSDN Library article #CC668202, to provide "shareable" links for a ASP.NET forms site, and have run into a strange issue: For users attempting to open links from PowerPoint presentations, and who have IE set as their default browser, using one of these links forces (forms-based) re-authentication, even in the same browser instance with a live session. Info: We know the session is still alive. (Page returns information for the currently logged-in user; confirmed via debug watches) This doesn't happen with other browsers (FF, Chrome) or with other programs (Notepad++) as the URL source. We do not have a default path set, as this caused issues with root path handling at initial login. This primarily happens with PowerPoint, but will also happen in Word and OCS. On some machines, even after changing the default browser, Office apps will continue to use IE for these links, forcing this error. (A potential registry fix for this failed, but even if it had worked, we can't control default browser choice for our users.) We can't figure out if this is an Office oddity or is being caused by our decision to use app-level URL routing (rather than IIS rewriting). Has anyone else encountered this and found a solution?

    Read the article

< Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >