Saving Global Parameters?
Aug 5, 2010
I'm just about hitting the logging page of our company new website, every user has his own settings of restrictions, since i don't want to load those values from the database in each page, my current idea is to save it once he log in in a session as a class of "Employee" and use them at will.is this consider good approach or should i go another way?
View 12 Replies
Similar Messages:
Nov 26, 2010
How to point url from Global file using URL routing 3.5 asp.net without parameters?
For example:
[code]....
View 1 Replies
Mar 19, 2010
[Code]....
here PublisherId is one parameter , i need to pass another parameter like Type in above line. I have tired but json fucntion wont call
View 7 Replies
Nov 17, 2010
I have a details page containing a form field named UserId. On the same page i have another search form with a field also named UserId.
I am using Html.LabelFor(vm > vm.UserId) and Html.TextBoxFor(sm > sm.UserId) on the two different view models, vm being the view model and sm being the search model. (Yes, the UserId property on the two models has identical names - because they are the same domain property.
When i navigate to the page, the populated UserId on the vm is inserted into BOTH form fields named UserId by MVC. Even the sm.UserId are empty.
That is my initial problem. There are a few ways ti avoid that. My solution was to use the Prefix flag for the sm.
[code]...
My problem is that MVC can't map the Search.UserId (because of the .) to fit the UserId (prefixed with Search) in the action shown above.
So it seems like MVC has a prefix-feature, that are actually nok fully supported through the Route-handler.
Ofcourse i could rename the Search.UserId to Search_UserId, but then the name dosent match the name MVC expects in the recieving action above. (expects Search.UserId) Renaming The UserId property of the search model would fix the issue, but since it is the same value in the domain, this seems like a workaround.
View 1 Replies
Feb 8, 2011
I know there is a couple answered questions on here regarding "request scoped" globals, but I want to nit-pick on something specifically and maybe squeeze some extra enlightenment out of one or two of you.I have an ASP.NET C# Website and a static Dictionary of objects (loaded from DB once on Application start). Each page request will need to do a lookup in the Dictionary (based on a key derived from the request url/etc) and get the appropriate object.The issue is I'm trying to maximize efficiency by reducing the lookups to the Dictionary per Request. Doing just a single lookup within a Page itself is easy enough and I can pass the object to sub controls, etc too.. but global.asax is separate from the Page and it also needs to use the object (in Application_BeginRequest and Session_Start).
So is doing a Dictionary lookup once in Application_BeginRequest, once (when necessary) in Session_Start and once in the Page negligible speed wise, even if there are many requests coming in every second?I would like it if I could just have a Request scoped global variable that I can easily call upon.. the only one I see available though is HttpContext.Current.Items and that is a Dictionary itself.Am I beingridiculously nit-picky with my concern over efficiency? or will these milliseconds (nanoseconds?) get me in the long run when more and more requests are being made?
PS. I currently only have around 100 objects in the Dictionary although this may increase in the future.
View 2 Replies
Feb 16, 2011
[Code]....
When I want to get the output values its okay but I also want returning a table as a result data.But Datareader has no rows.is it possible if I want a returning query result and multiple output values togather ?I wrote a test above.I can get output values as sqlparameters. But Datareader attached to a Gridview is empty.can you detect whats wrong here and it doesnt return a query result.So stored procedure is not standart or ı am doing something wrong.this doesnt raise any exception.but not returning any data.
[code]....
View 8 Replies
Jun 7, 2010
I want to define a route that have 2 optional parameters in the middle of the URL the start an end parameters are digits
[Code].....
View 1 Replies
Dec 10, 2010
Since ASP.NET MVC3 RC2 I encounter a bug when posting values to a controller method of which one of the parameter is a nullable int. Steps to reproduce:
I've created a test method
[code]....
In MVC3 RC1 this was working without any problems with the nullable int
Update:
I don't seem to have the problem with a newly created MVC3 website. What could I have in my project that influence model binding to nullable int's? And why would there be a difference between RC1 and RC2?
View 10 Replies
May 12, 2010
I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using
data:JSON.stringify({fname:firstname,lname:lastname,city:city})
now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here.
But I do not understand how can I identify which and how many parameters have been passedto the webmethod to insert/update the data to the DB.
View 4 Replies
Jan 21, 2010
here is my code for selectiong some records from db table
string strSql = "select * from mtblNBD where SentTo=@SentTo and InternalStatus Is NULL order by DeadLine desc";
SqlCommand com = new SqlCommand(strSql, con);
com.Parameters.Add("@SentTo", SqlDbType.NVarChar, 50).Value = (string)Session["uname"];
here I am using parameters for SenTo field but not for NULL so it is ok... or should I use parameters for this field where value is NULL , if yes then how can I use parameter for this
View 8 Replies
Jan 3, 2011
I have two examples to show you what I want to achieve here. But to point what's different about my question, Is that I'm having a parametrized URLs and I want to implement URL rewriting to my application. But I don't want to convert the parameter in the URL to be placed between slashes..."page.aspx?number=one" to "pages/one/" << NOT!
First example:
http://localhost:1820/Pages/Default.aspx?page=2&start=5
To
http://localhost:1820/Pages/page2
Second example:
http://localhost:1820/Items/Details.aspx?item=3
To
http://localhost:1820/Items/ItemName
But I'll still need all the parameters in the original URLs
View 2 Replies
Mar 30, 2011
I have a stored procedure that works fine for classic asp, but how can I get my output parameters data back from in /MVC 2 / linq/ entities framework model . I have inported the function also, but when i try to code it i dont get results ...i know this is a matter of lack of / knowledge or exmple because i have been scouring the web for it and cannnot find into that accually works.
here is the stored proc.
[Code]....
Here was the one of the few tries I did:
[Code]....
but it executes fine does not give me an error, but also does not return the info i need to the viewmodel
I keep seeing stuff about "ref" on the net but "ref" shows " arbument # should not be passed with the ref keyword.
So i am not sure if there is a problem with the model, or with my understanding this, Now for your info I can do the same step with returning a dataset from a stored procedure fine, but I dont want a data set I just want excatly the data in the output parameters from the stored procedure.
View 2 Replies
Feb 26, 2010
how can we use global.asax in asp.net? and what is that?
View 4 Replies
Mar 11, 2010
Is it possible to use global variables in C#? I'm coming from mainly a PHP background so variables are either accessible everywhere or just a global definition away.
My main issue is I have a User class that I built myself to wrap around the current users table on my company's database. I am defining it in the MasterPage but can't seem to access it from the actual pages (I don't know if there's a better word to describe them but they are the pages that inherit the styles and format from the MasterPage) Any general tips or implementation practices for me?
EDIT: here's some code snippets of what I'm trying to do:
Site.master.cs
public partial class SiteMaster : System.Web.UI.MasterPage
{
public User user = new User();
}
logout.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="logout.aspx.cs" Inherits="logout" %>
<%@ MasterType virtualPath="~/Site.master"%>
logout.aspx.cs
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
User user = Master.user;
}
}
View 7 Replies
Dec 28, 2010
I have a process within my MVC 2 application that takes a large amount of time and alters many rows in the database in the process.
There is a chance that two or more users could attempt to perform this action at the same time, which would lead to undesirable effects.
Is there a way to set a global flag somewhere within asp.net that I can check against all requests to see if the action in question is currently being executed? (a bit that I flip prior to running query, and then then flip back on completition)Or is there a better way of handling this situation?
View 2 Replies
Jan 14, 2010
in some projects (web application projects) I'm using global resource files. (Stored in the App_GlobalResources folder)pro:Really easy to use: e.g. in the markupProperty="<%$ Resources:FILENAME, KEY %>"con: As far as I know, I can't change the content of the resources on the fly. So if a customer is calling and tells me to change a string in the french implementation, I need to deploy a new binary. While using SessionMode="InProc" that might lead to undesired behaviour, like session loss etc.
View 2 Replies
Aug 17, 2010
I need to restrict multiple users from logging into my system. I am using Application_OnPostAuthenticateRequest event in global.asax to see if anybody is logged in. It works really well. But CSS is not loading and the screen looks horrible. If I comment out the code in that event, the page renders perfectly. What am I missing? What does Application_OnPostAuthenticateRequest has anything to do with CSS??
View 1 Replies
Jun 20, 2010
Is it possible in the global.asax file on session_start to check if a url string exists and it it does insert the string into a sql database? The url would be something link http://www.mysite.com?campaign=january.
I would want to capture the january bit and put that in the database for each visitor that uses that url.
View 3 Replies
May 6, 2010
I have a webform that has multiple textboxes that the user fills in plus a datatable that could have one record or multiple records. Basically it's an order page, I'm still a newbie and I would like to save this information to a sql db table. The user would fill out the textboxes with name, address, ect.. and the datatable contains products that they selected from a previous screen. I'd like to have a "Submit Order" button, when that is pressed the information on the webform gets saved as a record within the db. If there are multiple records in the datatable the name and address information could be saved multiple times (one per each record in the datatable)
View 9 Replies
Nov 4, 2010
I've got this.
[Code]....
At Context.SaveChanges() nothing is being updated. I'm not receiving any erros either.
View 2 Replies
Jan 27, 2010
I want to make All Methods about Error handling in asp.net some one device me at using global.asax what is global.asax?
how can i use it ?
View 1 Replies
Dec 10, 2010
I need to write an application which globally intercepts Alt+Shift+S.What I did is I created a DLL which sets global hooks:
Code:
namespace Hotkeydll
{
public class MyHotKey
{
[code]...
Then I created a program which loads this DLL and set the hook:
Code:
using Hotkeydll;
namespace IWFHotkeyStarter [code]...
{Now the problem is that the hotkey doesn't work.It looks like the DLL is not loaded permanently into memory. I see that I can delete the dll file from file system.
View 1 Replies
Mar 27, 2011
i want to have a timer in my site that will work for all the site where have i to put this timer?i mean if i put it in one aspx it will work only for this page or not?
View 25 Replies
Jul 21, 2010
i want to redirect from global.aspx to another page. How can I achieve this. I tried with following steps, but no effects on this:
1 Response.Redirect("~/login.aspx")
2 Me.Context.Response.Write("window.parent.location. href='login.aspx';")
3 Context.Response.Redirect((DirectCast(Context.Hand ler,System.Web.UI.Control)).ResolveUrl("~/logout.aspx"))
View 1 Replies
Dec 31, 2010
My doubt is i have two tables with Id as (Primary key) in one table and in the next table i have a Category Id field as Foreign key relationship with the 1st tabl Id field...
I have created a create view for the 1st table.My question is i have created a partial view for the 2nd table,but i need to pass the Id value to the second tables category Id field...So is there any way to do it by using Viewdata?
View 3 Replies