C# - How To Fetch Information Passed In The Url
Apr 4, 2011
I am trying the new feature of .NET 4.0 - url routing but not able to fetch information passed in the url. Following is the code :
GLOBAL.ASPX.CS
protected void Application_Start(object sender, EventArgs e)
{
SetRouting(RouteTable.Routes);
}
private void SetRouting(RouteCollection routeCollection)
{
routeCollection.MapPageRoute("Company",
[Code]....
Now the property mentioned above returns null even when i use Client/Google in the url. When i reset IIS and do it for first time, it returns value. Otherwise it gives null.
View 1 Replies
Similar Messages:
Aug 9, 2010
Split of from [URL]
tel me some code to refresh my asp page automatically after say 40 minutes to fetch latest data from database.
View 3 Replies
Nov 17, 2010
my website need a function to allow domain users jump over the login page and directly access the contents of the site. but for other users which there are not in the domain or they are not the member of the domain then they have to login the website through the login page.
this is different with ask user login to the domain through a login page. the website must distinguish is the user a domain user and the user name in the domain or not when the user first time access website.
View 2 Replies
Jul 13, 2010
My web application will be launched through existing thick client applications. When launched, an HTTP POST request will be generated including information like the userID and additional context information (basically stuff like the target user's name, birthday, etc.).
My plan for authentication is for there to be a look-up table in the database. If the username is already there, automatically login the user, but if there is no entry in the database, redirect the user to an initial login page which will be used to create that database entry.
My question is how to secure this against MITM and other security holes. How can the request generated through the thick client be on an SSL connection? Doesn't an SSL connection have to be authenticated with the username (and password) first? And if so, will the additional context information be publicly exposed until the user is logged in?
View 1 Replies
Dec 23, 2010
I have implemented Forms authentication in an ASP.NET MVC 2 website
By using <%: Page.User.Identity.Name %> on the Site.Master page I can display the userid of the logged in user.
I would like to use this value and display other information about the user that is stored in a User table in a MsSQL database, like:
<%: GetFirstname(Page.User.Identity.Name) %>
View 2 Replies
Sep 21, 2010
I want design a page where the end user enters information on my page and related information is fetched from the another website on my web page.
For example: Capturing City and state name from USPS.com
End user Task : Enter zipcode and click button 'Fetch'
My page perform few task
1. opens usps site backend
2. Enters the zipcode
3. Captures city name and state as temporary value from the usps
4. Displays the same in labels present in my home page.
View 2 Replies
May 6, 2014
I am trying to retrieve SessionItemShory column for given sessionid.The data stored is serialized so we need to deserialize the data to use it.I am trying to do that but its not working.
[Serializable]
public class sessiondata {
public string username { get; set; }
public string country { get; set; }
public string city { get; set; }
[code]...
View 1 Replies
Jan 19, 2011
I am making an online form (literal form) that needs to have a certain function: when the user enters a 5-digit number, the form should automatically query the MS SQL DB and retrieve information associated to that number and populate other form elements (text boxes, etc.) accordingly.
So say the # was 12345 and in the DB, the record matching 12345 has name=Fred. So, when I enter 12345 into the form textbox, the name text box should be automatically populated with Fred in it.
If this is not easily achievable, I guess a submit button beside the 5-digit number text box can do.
I am still learning my way around ASP.NET and Visual Studio 2005, however I have ample experience with HTML, CSS, JavaScript, C/C++. The ASP.NET app is to be written in C#.
View 1 Replies
Sep 6, 2010
I'm trying to develop my application and I've got a master page where I'm planning to create a div container, where my "news" will be loaded from my database and will be shown always on a main site. Then inside of the main placeholder I'm planning to load some extra data too from my database... and there's the question: how to solve that ? is there any possibility to pass a model to a master page ? or two viemodels to a view page inside the main placeholder on my page ? (one with news, and other containing some other data).
View 4 Replies
Nov 30, 2010
I'm having trouble figuring this error out. I have a grid on an ASPX page that displays data from a stored procedure in an SQL Server 2008 database. When the page loads, I get the following error:
"Procedure or function <sp_name> has too many arguments specified."
Here is the code for the grid and the datasource:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" ShowFooter="True" OnRowDataBound="GridView1_RowDataBound"
AllowSorting="True">
[code]....
Here's the code from the stored procedure:
ALTER PROCEDURE [dbo].[sp_GatewayMerchants]
-- Add the parameters for the stored procedure here
@StartDate DateTime,
[code].....
The datasource is passing 4 parameters, and the stored procedure is accepting 4, but when the page displays I get the error mentioned above.
EDIT: Here's the code behind for the template column. But I'm not sure how this could be causing extra parameters to the SP.
protected void Command_Click(object sender, EventArgs e)
{
var merchantID = Convert.ToInt32(((LinkButton)sender).CommandArgument);
[code].....
If I remove the ASP:LINKBUTTON the code works. So why would a LINKBUTTON be causing this?
View 4 Replies
Mar 19, 2010
I have a page that renders a hidden value from the model:
<%=Html.Hidden("myName", model.myValue) %>
Since I am passing a value in the value parameter, you would think it would output that value, but it doesn't.The code for rendering input fields has the following:
string attemptedValue = (string)htmlHelper.GetModelStateValue(name, typeof(string));
tagBuilder.MergeAttribute("value", attemptedValue ?? ((useViewData) ? htmlHelper.EvalString(name) : valueParameter), isExplicitValue);
Basically, if the ModelState (which contains posted values) contains a value for the "name" passed, it will use that value instead of your passed value to the helper method. In my case, I updated the model and my updated value wasn't outputted.If I pass a value to a method, I expect that value to be rendered.
View 1 Replies
Jul 20, 2010
I have a service. I have an existing class of business objects. What I would like to know is how can I pass a class through WCF from the business object assembly without having to create a new class in my WCF site while appending or tags?
Here is an existing UDT:
[code]....
View 2 Replies
Sep 3, 2010
While Executing My Contact Management Asp.Net MVC application ,i am getting following error :
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[ContactManagementSystem.Models.EmployeeMaster]', but this dictionary requires a model item of type 'ContactManagementSystem.Models.ViewData.IndexModel'.
from index.aspx View
My index.aspx Code is
like
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ContactManagementSystem.Models.ViewData.IndexModel>" %>
View 7 Replies
Dec 6, 2010
i have the following:
[Code]....
which is called in the controller for my index view which then calls a partial control
this does what i want for the first level in. How do I get it to work for N levels? my view
[Code]....
the count is 0 after the first time through. How can i get the partial view to take what is passed and find its children to that parent
View 7 Replies
Aug 9, 2010
I hope this makes sense. I want to pull the largest record from an Access dB if no parameter is passed in a QueryString.
Under normal situations, my query might look like this; http://www.XYZ.com/videos.aspx?id=1
What I would like to do is have the page "http://www.XYZ.com/videos.aspx" load the MAX ID record by default. I tried this, but it won't even load the page portion that is suppose to contain the data and returned no errors;
<asp:AccessDataSource id="AccessDataSource2" runat="server" DataFile="_database/92592_Web.mdb" SelectCommand="SELECT *, (SELECT MAX(ID) FROM myMovies) as Max_IDFROM [myMovies] WHERE ([ID] = ?)" CancelSelectOnNullParameter="False">
<SelectParameters> [code]...
View 5 Replies
Jan 28, 2014
I have read about desearlizing a json file into class fields which I understand. But what I cannot find in a tutorial is how to read in the json data. Everyone just adds the data to a variable and uses it. I will be passing in a json file from a mobile app. I know I should use a web service but for now I want to use an asp.net ASPX page to do this. I will be using the newtonking json control.
View 1 Replies
Aug 10, 2010
Just to rule it out, I have tried using the AJAX Rating system to no success, so i've decided to develop my own (as useful as AJAX seems to be for some reason I've never got it working on my system). I'm using a Star Rating Widget I attained from [URL] and from there I've taken a demo (so that it is working) and started editing it accordingly to my needs.
What I am setting out to do convert the radio buttons to stars (done via jQuery and working correctly). The user selects their rating then clicks the the Submit Button. The C# in the Submit OnClick Event then accesses the database, using LINQ to SQL, taking the current 'NumberOfVotes' value and adds one to the number, storing in an int object ready to update. The current 'Rating' Value is then updated too, by adding the Value of the Radio button to the current Rate Value then divided by the number of votes (to create the average rating) 'This article has been rated 4.28/5 by 286 Voters.'
However, the value from the selected radio button isnt being passed through to the back end, as debug has shown, and as you will see in the code below. The jQuery does state a callback which i had initially commented out (due to errors being caused). I have since reassigned it as advised, with a small edit in it to call the btnSubmit control and thus its onclick Event. Im not sure on a resolution to this having tried the only advised suggestion fail. The result of which posts back the message which should appear if no value/star was selected ("You have not selected a rating!"). If I can somehow transfer the jQuery to the ASp:RadioList I would do so, as I think this would be better in terms of calling and processing the data. Being new to it, I have no idea. In addition, apologies if my coding appears scrappy or poor
C#:
Csharp Code:
protected void btnSubmit_Click(object sender, EventArgs e)
{
RatingSys rate = RatingSys.Get(1);
int RateID = Convert.ToInt32(hdnRateID.Value);
int CurrentRating = rate.Rating.Value;
int RadioValue = 0;
int NewRating = 0;
int NumberOfVotes = 0;
if (!radio1.Checked || !radio2.Checked || !radio3.Checked || !radio4.Checked || !radio5.Checked)
{
lblMessage.Text = "You have not selected a rating!";
return;
}...................
View 1 Replies
Sep 1, 2010
What is the correct way to pick up a querystring variable that is passed to the page that the Silverlight Control is being hosted on?
View 1 Replies
Jan 13, 2010
In my application if I get an exception I catch it and send stackTrace through email. I also need the values of parameters passed to this function. I can get the names of function and parameters using MethodBase class of System.Reflection.
View 7 Replies
Mar 31, 2011
Why is a null parameter being passed to the following controller action?
public FileContentResult GetImageForArticle(ArticleSummary article)
{
if (article == null || !article.ContainsValidThumbNail()) return null;
return File(article.ThumbNail, article.ThumbNaiType);
}
from the following partial view:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<AkwiMemorial.Models.ArticleSummary>>" %>
<%if (Model.Count() > 0) [code]...
View 1 Replies
Nov 9, 2010
Our app uses session to keep track of users. We stuff their user id into session on logon. If the browser cache is cleared any refresh to the page is done then the user will see the log out sign - as the app cant get theuser id from session as the aspnet_session cookie wont be present in the request.Firefox works correctly but when I clear the cache on i.e. the session is maintained. The session ID's are the same for multiple requests.how I can debug the app to see what cookies its getting. How do I look at the actual cookie that is passed to .net?
View 2 Replies
Jan 20, 2011
I have got an external application(Serena Business Mashups), SBM is a business management tool and we are using as a defect tracker.
it has got a web service to do database operations.
I need to update a field on this system using their web service, the data I need to update is a long(110000 chars) string.
so when I invoke the update method, the data gets updated but it is truncated. I have pasted my web config setting below. So is there a limitation which I do not know?
I am using asp.net web services, not WCF.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="aewebservices71" closeTimeout="01:00:00" openTimeout="01:00:00"
receiveTimeout="01:00:00" sendTimeout="01:00:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered".....
View 1 Replies
Dec 20, 2010
I'm looking into building an ASP.NET MVC application that exposes (other than the usual HTML pages) JSON and XML REST services, as well as Web Sockets. In a perfect world, I would be able to use the same URLs for the Web Sockets interface as I do for the other services (and determine which data to return by what the user agent requests) but, knowing that IIS wasn't built for persistent connections, I need to know if there's a way that I can accept (and possibly even handshake) the Web Sockets connection and then pass the connection off to another service running on the server. I do have a workaround in mind if this isn't possible that basically involves using ASP.NET to check for the Web Sockets connection upgrade headers, and responding with a HTTP/1.1 302 Found that points to a different host that has my Web Sockets service configured to directly listen to the appopriate endpoint(s).
View 4 Replies
Feb 9, 2011
I have a problem with dll. I have a class library and genrerated a dll. that dll has business entity object.If i pass value from front end t that dll.The value has not been accepted.Its remaining null after i passed the value
View 2 Replies
Jul 1, 2010
I am trying to use the Slideshowexternder control with a contextKey that I've set from a query string. I set the contextKey in the default.aspx.vb Page_Load as I've read in other posts, but I am still getting an error:
The server method 'GetSlides' failed with the following error: System.InvalidOperationException -- Invalid webservice call, missing vaule for parameter: 'ContextKey'
[Code]....
View 1 Replies