Search Results

Search found 15797 results on 632 pages for 'session variables'.

Page 120/632 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • Display gridview in new window

    - by Ricardo Deano
    Hello all. Just a bit of advice needed really in terms of how I should handle my current scenario: I have a web page that searches for products/category information the results of which are at present displayed in a gridview on the same page. However, said gridview is a bit of a beast and as such, I would like to have a page that the user searches for, a button is pressed and the subsequent gridview is displayed in a new window. Ultimately, I would like the user to be able to make multiple searches so that new windows can have multiple gridviews containing different data sets. My current thinking is to create session variables that can be pulled through onto 'the gridview page'. Having said that, I'm not sure that would work if multiple searches are created? I am also thinking I might be able to create said 'gridview window' using javascript but my concern here is the potential loss of functionality of the gridview i.e. paging, sorting, editing, etc. Does anyone have any thoughts or theories on this? What would be "best practise"? Any thoughts greatly appreciated and taken on board. PS: This is being developed in .net, using c# and LINQ. PPS: I'm a noob so be gentle!!

    Read the article

  • extern and global in c

    - by JPro
    Can anyone please tell me is there any special requirement to use either EXTERN or GLOBAL variables in a C program? I do not see any difference in a program like below, if I change from gloabl to extern. #include <stdio.h> #include <stdlib.h> int myGlobalvar = 10; int main(int argc, char *argv[]) { int myFunc(int); int i; i = 12; myGlobalvar = 100; printf("Value of myGlobalvar is %d , i = %d\n", myGlobalvar, i); i = myFunc(10); printf("Value of passed value : %d\n",i); printf("again Value of myGlobalvar is %d , i = %d\n", myGlobalvar, i); system("PAUSE"); return 0; } int myFunc(int i) { i = 20 + 1000; //extern int myGlobalvar; myGlobalvar = 20000; // printf("Value of passed value : %d",i); return i; } If uncomment extern int myGlobalvar, the value does not change. Is there any correct difference between both? Can anyone please correct me?

    Read the article

  • Access reading error when using class member variable

    - by bsg
    Hi, I have a class with private member variables declared in a header file. In my constructor, I pass in some filenames and create other objects using those names. This works fine. When I try to add another member variable, however, and initialize it in the constructor, I get an access reading violation. I sent the code to someone else and it works fine on his computer. Any idea what could be wrong? Here is the offending code: The .h file: class QUERYMANAGER { INDEXCACHE *cache; URLTABLE *table; SNIPPET *snip; int* iquery[MAX_QUERY_LENGTH]; int* metapointers[MAX_QUERY_LENGTH]; int blockpointers[MAX_QUERY_LENGTH]; int docpositions[MAX_QUERY_LENGTH]; int numberdocs[MAX_QUERY_LENGTH]; int frequencies[MAX_QUERY_LENGTH]; int docarrays[MAX_QUERY_LENGTH][256]; int qsize; public: QUERYMANAGER(); QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname); ~QUERYMANAGER(); This is the .cpp file: #include "querymanagernew.h" #include "snippet.h" using namespace std; QUERYMANAGER::QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname){ cache = new INDEXCACHE(indexfname, btfname); table = new URLTABLE(urltablefname); snip = new SNIPPET(snippetfname, snippetbtfname); //this is where the error occurs qsize = 0; } I am totally at a loss as to what is causing this - any ideas? Thanks, bsg

    Read the article

  • Does WordPress clear $GLOBALS ?

    - by Brayn
    Hey What I want to do is to include one of my PHP scripts in a Word Press theme. The problem is that after I include the script file I can't access, inside functions in the theme file, variables declared in the script file . I have created a new file in the theme folder and added the same code as in header.php and if I open that file it works just fine. So as far as I can tell it's something Word Press related. /other/path/wordpress/wp-content/themes/theme-name/header.php // this is broken /other/path/wordpress/wp-content/themes/theme-name/test.php // this works /var/www/vhosts/domain/wordpress/ ->(symlink)-> /other/path/wordpress/ /other/path/wordpress/wp-content/themes/theme-name/header.php /var/www/vhosts/domain/include_file.php Content of: /var/www/vhosts/domain/include_file.php $global_var = 'global'; print_r($GLOBALS); // if I open this file directly this prints globals WITH $global_var; // if this file is included in header this prints all the WP stuff WITHOUT $global_var; Content of: /other/path/wordpress/wp-content/themes/theme-name/header.php require '/path/to/include_file.php'; print $global_var; // this prints 'global' as expected function test() { global $global_var; print $global_var; // this is NULL } test(); print_r($GLOBALS); // this prints all the WP stuff WITHOUT $global_var in it

    Read the article

  • Meta tag depending of selected language and title

    - by lena
    Hi, I'm aware about Google ignore most of the time, meta tag and use content. (This is not the point here) I'm working on an existing web site, not created by me. I need a quick solution, I guess with variables. The website construction: (no known template system) index.html which is presentation page with language selection index.php which embeding menu, content, footer several content pages that are embedded by index.php What I need to do only for those 2 pages welcome_en.html and welcome_fr.html (these pages are embedded so no header possible on these page) to have different page title (browser title) and different META tag. Any solution is welcome Thanks extra information Language detection on index.php: <?php $lang = $_GET['lang']; $page = $_GET['page']; if ($_GET['page'] == "" || !$_GET['page']) { $page = "welcome"; } if ($_GET['lang'] == "" || !$_GET['lang']) { $lang = "_fr"; } ? <td><img src="images/ban02<?php echo "$lang" ?>.jpg" width="531" height="60" <?php if ($_GET['lang'] == "_fr" || $_GET['lang'] == "" || !$_GET['lang']) { echo "alt='text'";} else if ($_GET['lang'] == "_en") {echo "alt='text'"; } ?>></td> for the embeded menu, footer ect like this one <?php include "menu.php"; ?> for the embedded content <?php //echo "$page$lang.html"; $lang = preg_replace('/[^a-z0-9_ ]/i', '', $_GET['lang']); $page = preg_replace('/[^a-z0-9_ ]/i', '', $_GET['page']); include $page . $lang . ".html"; ?>

    Read the article

  • Retrieve the Value of An Integer Variable

    - by Abluescarab
    This is probably easily figured out (I feel very stupid right now), but I can't find a solution anywhere, for some reason. Perhaps I'm not searching for the right thing. And maybe it's in some beginner tutorial I haven't watched. Anyway, I was wondering how to retrieve the value of an integer variable in C++? I know you can use cin.getline() for string variables, but I received an error message when I attempted that with an integer variable (and rightfully so, I know it was wrong, but I was looking for a solution). My project is a Win32 console application. What I'm trying to do is ask a user to input a number, stored in the variable n. Then I take the value of n and perform various math functions with it. In my header file, I have string, windows, iostream, stdio, math, and fstream. Do I need to add another library? There's not much more to tell. I can post my code if I must. EDIT: cout << "TEST SINE"; cout << "\nPlease enter a number.\n\n"; cin >> n; break; Here's the code I'm trying to use. Is this all I need to do? If so, how do I incorporate the variable so I can test it using sin, cos, and tan? Yet again, thanks ahead of time.

    Read the article

  • Use of unassigned local variable 'xxx'

    - by Tomislav
    I'm writing a database importer from our competitors to ours database:) I have a code generator which create Methods form import to our database like public void Test_Import_Customer_1() // variables string conn; string sqlSelect; string sqlInsert; int extID; string name; string name2; DateTime date_inserted; sqlSelect="select id,name,date_inserted from table_competitors_1"; oledbreader reader = new GetOledbRader(sqlString,conn); while (reader.read()) { name=left((string)myreader["name"],50); //limitation of my field date_inserted=myreader["date_inserted"]; sqlInsert=string.Format("insert into table(name,name2,date_inserted)values '{0}', '{1}', {2})",name,name2,date_inserted); //here is the problem name2 "Use of unassigned local variable" ExecuteSQL(sqlInsert) } As different companies database has different fields i can not set value to each variable and there is a big number of tables to go one variable to next. like sqlSelect_Company_1 = "select name,date_inserted from table_1"; sqlSelect_Company_2 = "select name,name2 from table_2"; is there a way to override the typing of each variable one by one with default values?

    Read the article

  • $_SESSION v. $_COOKIE

    - by taeja87
    I learned about $_SESSION about several weeks ago when creating a login page. I can successfully login and use it with variables. Currently I am trying to understand $_SESSION and $_COOKIE. Please correct me if I am wrong, I can use $_SESSION when logging in and moving around pages. With $_COOKIE, it is used to remember when I last visit and preferences. Another thing involving cookies is that when websites use advertisements (for example: Google AdSense), they use the cookies to track when visitor click on a advertisement, right? I can use both ($_SESSION & $_COOKIE)? I read somewhere that you can store the session_id as value for the cookie. Also, I read about security which let to me finding this: What do I need to store in the php session when user logged in?. Is using session_regenerate_id good for when a user comes back to the site? And this: How to store a cookie with php involving uniqid. For those wanting to know about the login, I use email and password. That way the user can be able to change their username. I look forward to learning more about these two from anybody who would like to share their knowledge about it. If I asked too many question, you can just answer the one that you have more experience with. If you need more information, just ask since I might have forgotten to include something. Thank You. Found this: What risks should I be aware of before allowing advertisements being placed on my website?

    Read the article

  • How do I access abstract private data from derived class without friend or 'getter' functions in C++?

    - by John
    So, I am caught up in a dilemma right now. How am I suppose to access a pure abstract base class private member variable from a derived class? I have heard from a friend that it is possible to access it through the base constructor, but he didn't explain. How is it possible? There are some inherited classes from base class. Is there any way to gain access to the private variables ? class Base_button { private: bool is_vis; Rect rButton; public: // Constructors Base_button(); Base_button( const Point &corner, double height, double width ); // Destructor virtual ~ Base_button(); // Accessors virtual void draw() const = 0; bool clicked( const Point &click ) const; bool is_visible() const; // Mutators virtual void show(); virtual void hide(); void move( const Point &loc ); }; class Button : public Base_button { private: Message mButton; public: // Constructors Button(); Button( const Point &corner, const string &label ); // Acessors virtual void draw() const; // Mutators virtual void show(); virtual void hide(); }; I want to be able access Rect and bool in the base class from the subclass

    Read the article

  • Javascript int variable from ASP.NET MVC Model data?

    - by Anders Svensson
    I need to get model data into a javascript variable and use it as an int to compare values. But I can only figure out how to get the model data as strings, otherwise the compiler complains. So how can I get the max and taskBudgetHours as int variables in the Javascript? <script type="text/javascript"> $(document).ready(function () { $("#taskForm").submit(function (e) { var taskBudgetHours = $('#BudgetHours').val(); var max = '<%: Model.Project.RemainingBudgetHours %>'; var test = 'test'; alert(taskBudgetHours); alert(max); if (taskBudgetHours <= max) { //This doesn't work, seems to treat it as strings... return true; } else { //Prevent the submit event and remain on the screen e.preventDefault(); alert('There are only ' + max + ' hours left of the project hours.'); return false; } }); return; }); </script>

    Read the article

  • How do I call a variable from another class?

    - by squeezemylime
    I have a class called 'Constants' that I am storing a String variable in. This class contains a few global variables used in my app. I want to be able to reference this class and call the variable (called profileId) in other Views of my app. I looked around and found a few examples, but am not sure how to do this. Currently my setup is: Constants.h @interface Constants : UIViewController { NSString *profileId; } @property (nonatomic, retain) NSString *profileId; @end Constants.m #import "Constants.h" @implementation Constants @synthesize profileId; - (void)dealloc { [profileId release]; [super dealloc]; } And I am trying to call the variable profileId in a new View via this way: NewView.h file @class Constants; NewView.m file NSLog(@"ProfileId is:", [myConstants profileId]); Is there something I'm missing? It is coming up null, even though I am properly storing a value in it in another function via this way: Constants *Constant; Constant = [[Constants alloc] init]; Constant.profileId = userId;

    Read the article

  • C++: Static variable inside a constructor, are there any drawbacks or side effects?

    - by doc
    What I want to do: run some prerequisite code whenever instance of the class is going to be used inside a program. This code will check for requiremts etc. and should be run only once. I found that this can be achieved using another object as static variable inside a constructor. Here's an example for a better picture: class Prerequisites { public: Prerequisites() { std::cout << "checking requirements of C, "; std::cout << "registering C in dictionary, etc." << std::endl; } }; class C { public: C() { static Prerequisites prerequisites; std::cout << "normal initialization of C object" << std::endl; } }; What bothers me is that I haven't seen similar use of static variables so far. Are there any drawbacks or side-effects or am I missing something? Or maybe there is a better solution? Any suggestions are welcome.

    Read the article

  • Testing variable types in Python

    - by Jasper
    Hello, I'm creating an initialising function for the class 'Room', and found that the program wouldn't accept the tests I was doing on the input variables. Why is this? def __init__(self, code, name, type, size, description, objects, exits): self.code = code self.name = name self.type = type self.size = size self.description = description self.objects = objects self.exits = exits #Check for input errors: if type(self.code) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 110' elif type(self.name) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 111' elif type(self.type) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 112' elif type(self.size) != type(int()): print 'Error found in module rooms.py!' print 'Error number: 113' elif type(self.description) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 114' elif type(self.objects) != type(list()): print 'Error found in module rooms.py!' print 'Error number: 115' elif type(self.exits) != type(tuple()): print 'Error found in module rooms.py!' print 'Error number: 116' When I run this I get this error: Traceback (most recent call last): File "/Users/Jasper/Development/Programming/MyProjects/Game Making Challenge/Europa I/rooms.py", line 148, in <module> myRoom = Room(101, 'myRoom', 'Basic Room', 5, '<insert description>', myObjects, myExits) File "/Users/Jasper/Development/Programming/MyProjects/Game Making Challenge/Europa I/rooms.py", line 29, in __init__ if type(self.code) != type(str()): TypeError: 'str' object is not callable

    Read the article

  • Pointers to a typed variable in C#: Interfase, Generic, object or Class? (Boxing/Unboxing)

    - by PaulG
    First of all, I apologize if this has been asked a thousand times. I read my C# book, I googled it, but I can't seem to find the answer I am looking for, or I am missing the point big time. I am very confused with the whole boxing/unboxing issue. Say I have fields of different classes, all returning typed variables (e.g. 'double') and I would like to have a variable point to any of these fields. In plain old C I would do something like: double * newVar; newVar = &oldVar; newVar = &anotherVar; ... In C#, it seems I could do an interfase, but would require that all fields be properties and named the same. Breaks apart when one of the properties doesn't have the same name or is not a property. I could also create a generic class returning double, but seems a bit absurd to create a class to represent a 'double', when a 'double' class already exists. If I am not mistaken, it doesn't even need to be generic, could be a simple class returning double. I could create an object and box the typed variable to the newly created object, but then I would have to cast every time I use it. Of course, I always have the unsafe option... but afraid of getting to unknown memory space, divide by zero and bring an end to this world. None of these seem to be the same as the old simple 'double * variable'. Am I missing something here?

    Read the article

  • Second user-defined function returns garbage value?

    - by mintyfresh
    I have been teaching myself C programming, and I've come to a difficult point with using variables across functions. When, I compile this program and run it, the function askBirthYear returns the correct value, but sayAgeInYears returns either 0 or a garbage value. I believe it has something to do with how I used the variable birthYear, but I'm stumped on how to fix the issue. Here is the code: #include <stdio.h> #include <stdlib.h> int askBirthYear(int); void sayAgeInYears(int); int birthYear; int main(void) { askBirthYear(birthYear); sayAgeInYears(birthYear); return EXIT_SUCCESS; } void askBirthYear(int birthYear) { printf("Hello! In what year were you born?\n"); scanf("%d", &birthYear); printf("Your birth year is %d.\n", birthYear); return birthYear; } void sayAgeInYears(int birthYear) { int age; age = 2012 - birthYear; printf("You are %d years old.\n", age); }

    Read the article

  • How should I track multi-valued page attributes (e.g. tags) using custom variables?

    - by Simon
    Our pages can each have many tags, e.g 'football', 'sms', 'nsfw', etc.. wich we would like to track in google analytics. We're already tracking things like category using google analytics custom variables. We've used three of the five available slots so far. How can we track tags the same way? If we just mush them all together - e.g. 'football, sms, nsfw' then can we track the ones that are tagged 'football'? What's the right way to track multi-valued page attributes using custom variables?

    Read the article

  • Ruby - when to use instance variables vs parameters between methods?

    - by Michael Durrant
    I'm writing several methods that call other methods. To pass the information I have a couple of choices: Pass the information as parameters Set instance variables so that other methods can access them When should I choose one option over the other? It seems that the first option is good as it is very specific about what is being passed. the downside seems to be that a lot of values are being passed around. The second method doesn't require passing all the values around but seems to lead to a lot of magic where methods set instance variables 'somewhere' Should I always be very explicit about gets passed to other methods in the class? Are there exceptions so this?

    Read the article

  • How should I track multi-valued page attributes (e.g. tags) using custom variables?

    - by Simon
    Our pages can each have many tags, e.g 'football', 'sms', 'nsfw', etc.. wich we would like to track in google analytics. We're already tracking things like category using google analytics custom variables. We've used three of the five available slots so far. How can we track tags the same way? If we just mush them all together - e.g. 'football, sms, nsfw' then can we track the ones that are tagged 'football'? What's the right way to track multi-valued page attributes using custom variables?

    Read the article

  • How to create a manager class without global variables nor singletons?

    - by Omega
    I would like to implement some kind of manager class in my application. It will be in charge of loading textures, processing them, distributing them etc... At first, I wanted to make a global variable that simply contains an instance of my manager class. I found this question: http://stackoverflow.com/questions/4646577/global-variables-in-java. However, the users there seem to recommend to never use global variables. Fine then, I once heard about Singletons, so I though I could use that instead. I mean, creating just one instance of my manager class sounds good. However, I found this other question: When is Singleton appropriate?, which basically tells me that Singletons are, in most scenarios, some kind of anti-pattern. Now I am a bit lost - what other approach can I take to create my manager class, whose only requirement is to be accessible from anywhere?

    Read the article

  • GNU screen, how to get current sessionname programmably

    - by Jimm Chen
    [ This can be considered step 2 of my previous question Is it possible to change GNU screen session name after created? ] Actually, I'd like to write a script that can display current screen session name and change current session name. For example: sren armcross It will change the session name to armcross (ARM gcc cross compiler) and output something like: screen session name changed from '25278.pts-15.linux-ic37' to 'armcross' So, the key question now is how to get current session name. Not only for display the old session name, but according to Is it possible to change GNU screen session name after created? , I have to know it(pass to -d -r) before I can change it to something else. Can we use $STY for current session name? No. $STY will not change after you have changed the session name to a user-defined one. However, for command screen -d -r <oldsessname> -X sessionname armcross should be the user-defined name(if ever defined) instead of $STY, otherwise, screen spouts error "No screen session found." Maybe, there is a verbose way, use screen -list to list all sessions(user-defined name listed), then, match the pid part from $STY against those listed sessions and we will find current session's user-defined name. It should not be so verbose for such a straightforward question. Don't you think so? The -d -D and -r -R options seems to expose too much implementation detail to screen's user. It seems, to rename a session, you have to detach it, then do the rename, then reattach it. Right? My env: opensuse 11.3, GNU screen 4.00.03 (FAU) 23-Oct-06 Thank you.

    Read the article

  • Can a pool of memcache daemons be used to share sessions more efficiently?

    - by Tom
    We are moving from a 1 webserver setup to a two webserver setup and I need to start sharing PHP sessions between the two load balanced machines. We already have memcached installed (and started) and so I was pleasantly surprized that I could accomplish sharing sessions between the new servers by changing only 3 lines in the php.ini file (the session.save_handler and session.save_path): I replaced: session.save_handler = files with: session.save_handler = memcache Then on the master webserver I set the session.save_path to point to localhost: session.save_path="tcp://localhost:11211" and on the slave webserver I set the session.save_path to point to the master: session.save_path="tcp://192.168.0.1:11211" Job done, I tested it and it works. But... Obviously using memcache means the sessions are in RAM and will be lost if a machine is rebooted or the memcache daemon crashes - I'm a little concerned by this but I am a bit more worried about the network traffic between the two webservers (especially as we scale up) because whenever someone is load balanced to the slave webserver their sessions will be fetched across the network from the master webserver. I was wondering if I could define two save_paths so the machines look in their own session storage before using the network. For example: Master: session.save_path="tcp://localhost:11211, tcp://192.168.0.2:11211" Slave: session.save_path="tcp://localhost:11211, tcp://192.168.0.1:11211" Would this successfully share sessions across the servers AND help performance? i.e save network traffic 50% of the time. Or is this technique only for failovers (e.g. when one memcache daemon is unreachable)? Note: I'm not really asking specifically about memcache replication - more about whether the PHP memcache client can peak inside each memcache daemon in a pool, return a session if it finds one and only create a new session if it doesn't find one in all the stores. As I'm writing this I'm thinking I'm asking a bit much from PHP, lol... Assume: no sticky-sessions, round-robin load balancing, LAMP servers.

    Read the article

  • GNU screen, how to get current sessionname programmatically

    - by Jimm Chen
    [ This can be considered step 2 of my previous question Is it possible to change GNU screen session name after created? ] Actually, I'd like to write a script that can display current screen session name and change current session name. For example: sren armcross It will change the session name to armcross (ARM gcc cross compiler) and output something like: screen session name changed from '25278.pts-15.linux-ic37' to 'armcross' So, the key question now is how to get current session name. Not only for display the old session name, but according to Is it possible to change GNU screen session name after created? , I have to know it(pass to -d -r) before I can change it to something else. Can we use $STY for current session name? No. $STY will not change after you have changed the session name to a user-defined one. However, for command screen -d -r <oldsessname> -X sessionname armcross should be the user-defined name(if ever defined) instead of $STY, otherwise, screen spouts error "No screen session found." Maybe, there is a verbose way, use screen -list to list all sessions(user-defined name listed), then, match the pid part from $STY against those listed sessions and we will find current session's user-defined name. It should not be so verbose for such a straightforward question. Don't you think so? The -d -D and -r -R options seems to expose too much implementation detail to screen's user. It seems, to rename a session, you have to detach it, then do the rename, then reattach it. Right? My env: opensuse 11.3, GNU screen 4.00.03 (FAU) 23-Oct-06 Thank you.

    Read the article

  • LAMP Setup, PHP's session_start permission denied

    - by Andrew
    I'm trying to set up a development environment for a legacy system that runs CentOS 4.8, PHP 4.3.9, and MySQL 4.1.22. I'm matching OS and software versions to keep the development server as close to the production server as possible. When I fire up PHPMyAdmin's setup script (version 2.11.10.1, of course) the installation errors out and I see these errors in my error log: [client 172.18.141.74] PHP Warning: session_start(): open(/var/lib/php/session/sess_b5b90f86bd3dcfad315ff24cb7483a79, O_RDWR) failed: Permission denied (13) in /home/www/intranet/phpmyadmin/libraries/session.inc.php on line 87 [client 172.18.141.74] PHP Warning: Unknown(): open(/var/lib/php/session/sess_b5b90f86bd3dcfad315ff24cb7483a79, O_RDWR) failed: Permission denied (13) in Unknown on line 0 [client 172.18.141.74] PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0 I've done some searching on ServerFault and on teh Googles and I see that a common reason for this error is that the session.save_path isn't writable by the www user. I also found where in /etc/php.ini this URL is set: session.save_path. My session.save_path is set to: session.save_path = /var/lib/php/session I've since changed the owner and the group of /var/lib/php/session and still have the same error. Here's the result of ls -la for /var/lib/php [root@localhost php]# ls -la total 24 drwxrwxr-x 3 www www 4096 Oct 23 20:21 . drwxr-xr-x 17 root root 4096 Oct 23 20:31 .. drwxrwx--- 2 www www 4096 Jun 1 2009 session ...But I'm still getting the same error. Is there another possibility for why I'm getting this error?

    Read the article

  • Autofac WCF integration + sessions

    - by Michael Sagalovich
    I am having an ASP.NET MVC 3 application that collaborates with a WCF service, which is hosted using Autofac host factory. Here are some code samples: .svc file: <%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.IMyContract, MyAssembly" Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf" %> Global.asax of the WCF service project: protected void Application_Start(object sender, EventArgs e) { ContainerBuilder builder = new ContainerBuilder(); //Here I perform all registrations, including implementation of IMyContract AutofacServiceHostFactory.Container = builder.Build(); } Client proxy class constructor (MVC side): ContainerBuilder builder = new ContainerBuilder(); builder.Register(c => new ChannelFactory<IMyContract>( new BasicHttpBinding(), new EndpointAddress(Settings.Default.Url_MyService))) .SingleInstance(); builder.Register(c => c.Resolve<ChannelFactory<IMyContract>>().CreateChannel()) .UseWcfSafeRelease(); _container = builder.Build(); This works fine until I want WCF service to allow or require sessions ([ServiceContract(SessionMode = SessionMode.Allowed)], or [ServiceContract(SessionMode = SessionMode.Required)]) and to share one session with the MVC side. I changed the binding to WSHttpBinding on the MVC side, but I am having different exceptions depending on how I tune it. I also tried changing AutofacServiceHostFactory to AutofacWebServiceHostFactory, with no result. I am not using config file as I am mainly experimenting, not developing real-life application, but I need to study the case. But if you think I can achieve what I need only with config files, then OK, I'll use them. I will provide exception details for each combination of settings if required, I'm omitting them not to make the post too large. Any ideas on what I can do?

    Read the article

  • What is the best way to route a static controller in Rails?

    - by yuval
    I have a static_controller that is in charge of all the static pages in the site and works as follows in routes.rb: map.connect ':id', :controller => 'static', :action => 'show' I have a static page called about that among other information, has a contact form. I currently have a contacts_controller that is in charge of inserting the contact information to the database. Inside my routes.rb file, I have: map.resources :contacts My contact form (simplified) looks like this: <% form_for @contact do |f| %> <p class="errors"><%= f.error_messages %></p> <p> <%= f.label :first_name %> <%= f.text_field :first_name %> </p> <p class="buttons"><%= f.submit %></p> <% end %> Which in turn submits to the create action of my contacts_controller. My create action looks like this: def create @contact = Contact.new(params[:contact]) if @contact.save flash[:notice] = "Email delivered successfully." end redirect_to "about" end The problem is, is the that when I redirect back to my about page the error_messages for the form get lost (since the error_messages for the form only exist for one request, and that request ends upon redirect). How would I go about preserving the error_messages and still linking the users back to the about static url? Would a session/flash be sufficient (if so, what code would I use to pass error messages) or am I going about this whole thing wrong? Thanks!

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >