Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

AngularJS 2.0 with MVVM and C#

$
0
0
Hi,

I am trying to find a good C# example Web Application which is using MVVM pattern with AngularJS 2.0, I am trying my best but not able to find, just asking is AngularJS 2.0 suitable with MVVM pattern, if it is can some body point me where I can get some example and sample code to practice.

Thanks in advance my friends, I am also googling but not able to find it.
 
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

Edit not working

$
0
0
Hi,

I created a mvc web project with scaffolding that displays well in the Index page. When I edit, I do not want any of the fields in the edit page to edit. Instead, I added a textbox whose value I calculate and save the rest of the fields to the database. I cannot get this to work, as the model in the HttpPost is null. Please help.

Thanks

npm install is not installing and erroring continuosly

$
0
0
Hi,

I am trying to run npm install, I'm not sure what's it, all I doing is following an article to make my application workable with Angular 2.0, but its never stopping giving me errors. I don't know why is so tough to install it.

I have created package.json file, copied the following script init. ABCSolution is my solution name and ABCWebApp is my asp.net mvc application name, I don't know which one should I use for the name there, I putting the Solution Name
{"version": "1.0.0","name": "ABCSolution","author": "Abdul Aleem","description": "This is for Calpers834","dependencies": {"@angular/common": "2.0.0-rc.5","@angular/compiler": "2.0.0-rc.6","@angular/core": "2.0.0-rc.6","@angular/forms": "2.0.0-rc.6","@angular/http": "2.0.0-rc.6","@angular/platform-browser": "2.0.0-rc.6","@angular/platform-browser-dynamic": "2.0.0-rc.6","@angular/router": "3.0.0-rc.2","@angular/upgrade": "2.0.0-rc.6","@types/lodash": "^4.14.42","core-js": "^2.4.1","moment": "^2.14.1","reflect-metadata": "^0.1.3","rxjs": "5.0.0-beta.6","systemjs": "^0.19.37","typings": "^1.3.2","zone.js": "^0.6.12"
  },"devDependencies": {"gulp": "^3.9.1","gulp-clean": "^0.3.2","gulp-concat": "^2.6.0","gulp-less": "^3.1.0","gulp-sourcemaps": "^1.6.0","gulp-typescript": "^2.13.6","gulp-uglify": "^2.0.0","typescript": "^1.8.10"
  },"scripts": {"postinstall": "typings install dt~core-js --global"
  }
}

I have created typings.json file and placed the following script there
{"globalDependencies": {"core-js": "registry:dt/core-js#0.0.0+20160602141332","jasmine": "registry:dt/jasmine#2.2.0+20160621224255","node": "registry:dt/node#6.0.0+20160621231320"
  }
}
I placed them in the Project folder first and ran the npm install from that same folder it gave me errors, then I placed these files in the Solution files, then ran the npm install, never leaving the errors.
I am frustrated and tired, I am not understanding what are those dependencies are what are those versions in them.

Can anybody please help me in this aspect, what went wrong, I really need this help a suggestion, a link or even a code snippet helps me greatly. What's this npm install why is it making my life so tired, I don't know.

And the error that I getting is as below:
 
npm ERR! peerinvalid The package @angular/common does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/forms@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/platform-browser@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/router@3.0.0-rc.2 wants @angular/common@^2.0.0-rc.6

And if I am running "npm run typings install" in either the Project folder or Solution folder, then its giving me the following error:
 
npm ERR! missing script: typings
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a>
npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\aaleem01\Desktop\Calpers834\npm-debug.log
 
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

Call JavaScript function from c# code in cshtml

$
0
0
Is it possible to call a javascript function in a cshtml, in the @{} section, and the javascript function is defined in the script section of the cshtml.

Thanks

How to bypass fields that have required validation to go to next page

$
0
0
I want to show required validator when Contract is selected on this toggle.

<labelfor="exampleNASAControlNumber">Is this a Contract or Solicitation?:</label><labelclass="switch2"><inputclass="switch-input2"type="checkbox"id="contractselection"name="contractselection"runat="server"/><spanclass="switch-label2"data-on="Solicitation"data-off="Contract"id="span2"runat="server"></span><spanclass="switch-handle2"></span></label>

The validation should work for this only when contract is selected:


<labelfor="exampleStartDate"style="position:relative; right:17px;">Contract Start Period:<spanstyle="color:red">*</span>:</label><divclass="bootstrap-iso"><divclass="row"><divclass=" zero-padding-left"><divclass="input-group"><divclass="input-group-addon"></div><inputclass="form-control"id="contractstartdate"name="contractstartdate"runat="server"placeholder="MM/DD/YYYY"type="text"style="width:240px;"/></div><asp:RequiredFieldValidatorID="RequiredFieldValidator6"ForeColor="Red"runat="server"ControlToValidate="contractstartdate"ErrorMessage="Please select a Contract Start Period"></asp:RequiredFieldValidator>


and disabled for this validator:


<labelfor="exampleStartDate"style="position:relative; right:15px;">Solicitation Start Period:<spanstyle="color:red">*</span>:</label><%--<SharePoint:DateTimeControl ID="SolicitationStartDateControl" runat="server" CssClassTextBox="form-control" DateOnly="True" />--%><divclass="bootstrap-iso"><divclass="input-group"style="position:relative; right:15px; width:296px;"><divclass="input-group-addon"></div><inputclass="form-control"id="solicitationstartdate"name="solicitationstartdate"runat="server"placeholder="MM/DD/YYYY"type="text"/></div><asp:RequiredFieldValidatorID="RequiredFieldValidator8"ForeColor="Red"runat="server"ControlToValidate="solicitationstartdate"ErrorMessage="Please select a Solicitation Start Period"></asp:RequiredFieldValidator>

The reverse of this when Solicitation is selected, the Contract Start Date validator should be disable and the Solicitation Start Date validator is enabled.

How do I do this?

Populate textboxes on dropdown selection using mvc4.net sqlserver2013

$
0
0
how to populate textboxes on dropdown selection using .net mvc sqlserver 2013 without entitydata. 

Export Gridview data to excel in asp.net

$
0
0
i want to ask about the post by ashish chaudhary, in which we are suppose to fill the datagrid and then export it to excel file. I am using the same code, but i am getting the error in the given below line.

"string Path = "D:\\DataListWebsite\\myexcelfile_" + DateTime.Now.ToString() + "_" + DateTime.Now.Month.ToString() + ".xls";
All the code is as it is..... No issue . Please help....

web service testing: what credentials to use for the aspx file?

$
0
0
Hello,

I am new with web services. I wish to test a web service that I created locally. If it works as expected I then will have it published on our web server. However, I can't figure out what user and password to provide the asmx page.

I began by modifying a Visual Studio 2008 project of web services by adding a new one. It looks just like the others in the project. In the code I added I reference a new stored procedure that I created.

This project uses a connection manager. I look at the web config and see a user id and a password. If I connect to SQL Server using this user id and password, I can execute the stored procedure and it works as expected.

However, when running the asmx page it shows me a list of web services defined within the project. If I click on any of them, the next page asks for a user name and password. If I provide the credentials of the user mentioned in the web config, then click the button with "invoke" as a caption, I always get this error: "System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server."

So the user name and password I found in the web config works on the new stored procedure when I test it entirely in SQL Server. Meanwhile, I can't figure out what user name and password I can provide the asmx page to test the web service itself. Is there an easy way to figure out what user name and password to provide an asmx page for testing a new web service?

The resource cannot be found. for mvc application

$
0
0
Hi All,

I have an MVC application which when I run the application it goes to http://localhost:49626/login.aspx?ReturnUrl=%2fhome%2findex, I am not sure why it goes and searches for the Login.aspx url, I am new to MVC, any help is going to be very helpful, I even set as specific page as this: home/index, still it goes onto login.aspx page.

I am very poor with url, I have register routes as below:
publicstaticvoid RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
Startup class as below
publicclass Startup
    {publicvoid Configuration(IAppBuilder app)
        {//app.MapSignalR();// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888        }
    }

I have area registration as below:
publicclass HelpPageAreaRegistration : AreaRegistration
    {publicoverridestring AreaName
        {get
            {return"HelpPage";
            }
        }publicoverridevoid RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute("HelpPage_Default","Help/{action}/{apiId}",new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });

            HelpPageConfig.Register(GlobalConfiguration.Configuration);
        }
    }

Any help is going to be very helpful for me as I am very poor in understanding the route mapping and configuration of ASP.Net MVC applications, any help a code snippet, a link or even suggestion would be very helpful, thanks in advance.
 
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

How to pass primary key ID field as parameter/UPDATE Statement

$
0
0
I want to pass the ACTIVITY_ID field (which is primary key) on an update statement where clause . I need help on how to do that. Here is Update Statement and parameters:

conn.ConnectionString = strConnection;
            conn.Open();

            OracleCommand cmd = new OracleCommand();
            cmd.Connection = conn;
            cmd.CommandText = "UPDATE BUYING_ACTIVITY SET CUSTOMER_SOURCE_CODE = :custsrc, CUSTOMER_NAME =:name, CUSTOMER_CITY = :city, CUSTOMER_STATE = :state WHERE _ACTIVITY_ID = ?";

            cmd.Parameters.Add(new OracleParameter(?));
            cmd.Parameters.Add(new OracleParameter("custsrc", custsrc));
            cmd.Parameters.Add(new OracleParameter("name", name));
            cmd.Parameters.Add(new OracleParameter("city", city));
            cmd.Parameters.Add(new OracleParameter("state", state));


            cmd.ExecuteNonQuery();

            conn.Close();


What value do I use to set = to ACTIVITY_ID on the WHERE clause is what I'm asking.

ASP.NET MVC Single Page Application with Type Script

$
0
0
Hi all,

I need any example or sample application or link anything to develop an ASP.Net MVC Single Page Application using Type Script. Can I write a Single Page application at all using ASP.Net and Type Script, if I can, can somebody please give me an example or sample code etc to help me out. I am new ASP.Net MVC and front-end coding I am more into Middle tier and Back-end coding.

Thanks in advance.
 
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

Javascript Book(s)

$
0
0
I am new to javascript but definitely not new to asp.net development. I was wondering why javascript is gaining popularity among asp.net developers
and what functionalities or features within an asp.net web application it is most often used for ;And also I was wondering is there a particular javascript book that would help me to learn the capabilities of javascript when used with asp.net. Thanks

Non-invocable member 'System.Web.UI.WebControls.ListControl.Items' cannot be used like a method error.

$
0
0
Getting error on bolded line, activitycode.Item(I),Value... if you can't see it.

privatevoid cvactivitycode_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = false;for (short I = 1; (I<= (activitycode.Items.Count - 1)); I++)
            {if (activitycode.Items(I).Value)
                {
                    args.IsValid = true;break;
                }

            }

        }


What am I missing or need to fix.

Dropdown pre-filled from prior page fires off required validator

$
0
0
I have a dropdown(code is name of the dropdown) that when coming from another page it prefills with a value, the required validator fires off. I have a select statement that fills in all textboxes and dropdowns on this page. When I open this page by itself the validation functions as normal meaning when I select a value from the dropdown no validation and when it is blank it validates. Here is the code for the select statement and reading in the data on page load:

OracleConnection conn = new OracleConnection();
            OracleCommand cmd = new OracleCommand();
            conn.ConnectionString = strConnection;
            conn.Open();

            cmd.Connection = conn;
            cmd.CommandText = "Select RID, CODE, CUSTOMER_NAME from ACTIVITY WHERE ID = :IDValue";//Add values to paramter            cmd.Parameters.Add(new OracleParameter("IDValue", Request.QueryString["ID"]));

            OracleDataAdapter da = new OracleDataAdapter(cmd);
            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();

            name.Text = dr["customer_name"].ToString();
            code.SelectedItem.Text = dr["code"].ToString();

            dr.Close();
            conn.Close();


I know this has Oracle code in it but it is more of a C#/ASP.net question.

Data not updating on fields using UPDATE Statement

$
0
0
I have these fields set to the asp controls below:

string contnumber = contractnumber.Text;string solnumber = solicitationnumber.Text;string ordnumber = ordernumber.Text;string contstartdate = contractstartdate.Value;string contenddate = contractenddate.Value;string solstartdate = solicitationstartdate.Value;string solenddate = solicitationenddate.Value;string soltype = solicitationtype.Text;string pasnum = pasnumber.Text;string commnts = comments.Text;string contkind = contractkind.SelectedItem.Text;string conttype = contracttype.SelectedItem.Text;string ponum = ponumber.Text;string instrtype = instrumenttype.SelectedItem.Text;string totcontractamount = totalcontractamount.Text;string estimloddate = estloddate.Value;string contfirstname = contractfirstname.Text;string contmiddleinit = contractmiddleinit.Text;string contlastname = contractlastname.Text;string lodsigned = datelodsigned.Value;string contractid = contractinfoid.Text;



when I open the form to update some of these fields the fields don't update when I step thru the code and obviously don't update using this update statement to the database:

 OracleConnection conn = new OracleConnection();  // C#                conn.ConnectionString = strConnection;
                conn.Open();

                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = "UPDATE CONTRACT_INFO SET  CONTRACT_SELECTION = :contractselection, CONTRACT_NUMBER = :contnumber, SOLICITATION_NUMBER = :solnumber, ORDER_SELECTION = :orderselection, ORDER_NUMBER = :ordnumber, CONTRACT_START_PERIOD = to_date(:contstartdate, 'MM/DD/YYYY'), CONTRACT_END_PERIOD =  to_date(:contenddate, 'MM/DD/YYYY'), SOLICITATION_START_DATE = to_date(:solstartdate, 'MM/DD/YYYY'), SOLICITATION_END_DATE =  to_date(:solenddate, 'MM/DD/YYYY'), SOLICITATION_TYPE = :soltype, SURVEY_REQUESTED = :preaward, PAS_NUMBER = :pasnum, COMMENTS = :commnts, CONTRACT_KIND = :contkind, CONTRACT_TYPE = :conttype, PO_ASSOCIATED = :poselection, PO_NUMBER = :ponum, INSTRUMENT_TYPE = :instrtype, TOTAL_CONTRACT_AMOUNT = :totcontractamount, EST_LOD_COMPLETION_DATE = to_date(:estimloddate, 'MM/DD/YYYY'), FIRST_NAME = :contfirstname, MIDDLE_INIT = :contmiddleinit, LAST_NAME = :contractlastname, DATE_LOD_SIGNED = to_date(:lodsigned, 'MM/DD/YYYY') CONTRACT_INFO_ID = :contractid";

                cmd.Parameters.Add(new OracleParameter("contractid", contractid));

                cmd.Parameters.Add(new OracleParameter("contractselection", contselection));
                cmd.Parameters.Add(new OracleParameter("contnumber", contnumber));
                cmd.Parameters.Add(new OracleParameter("solnumber", solnumber));
                cmd.Parameters.Add(new OracleParameter("orderselection", ordselection));
                cmd.Parameters.Add(new OracleParameter("ordnumber", ordnumber));
                cmd.Parameters.Add(new OracleParameter("contstartdate", contstartdate));
                cmd.Parameters.Add(new OracleParameter("contenddate", contenddate));
                cmd.Parameters.Add(new OracleParameter("solstartdate", solstartdate));
                cmd.Parameters.Add(new OracleParameter("solenddate", solenddate));
                cmd.Parameters.Add(new OracleParameter("soltype", soltype));
                cmd.Parameters.Add(new OracleParameter("preaward", preawardselection));
                cmd.Parameters.Add(new OracleParameter("pasnum", pasnum));
                cmd.Parameters.Add(new OracleParameter("commnts", commnts));
                cmd.Parameters.Add(new OracleParameter("contkind", contkind));
                cmd.Parameters.Add(new OracleParameter("conttype", conttype));
                cmd.Parameters.Add(new OracleParameter("poselection", purselection));
                cmd.Parameters.Add(new OracleParameter("ponum", ponum));
                cmd.Parameters.Add(new OracleParameter("instrtype", instrtype));
                cmd.Parameters.Add(new OracleParameter("totcontractamount", totcontractamount));
                cmd.Parameters.Add(new OracleParameter("estimloddate", estimloddate));
                cmd.Parameters.Add(new OracleParameter("contfirstname", contfirstname));
                cmd.Parameters.Add(new OracleParameter("contmiddleinit", contmiddleinit));
                cmd.Parameters.Add(new OracleParameter("contlastname", contlastname));
                cmd.Parameters.Add(new OracleParameter("lodsigned", lodsigned));



                cmd.ExecuteNonQuery();

                conn.Close();


This is used on a button click event. What am I doing wrong. Is there something I need to do when in addition to setting these fields so that they update when I change them on the form and in the database.

Need help on passing id to next page on response.redirect

$
0
0
I am inserting into the database and want to pass the id to the next page via response.redirect but am not sure how to do that.

Here is the code I have:

string custsrc = custsrccode.Text;string name = custname.Text;string city = custcity.Text;string state = custstate.Text;string postcode = custpostalcode.Text;string actcode = activitycode.SelectedItem.Text;string id = labelID.Text;string activityid = labelactivityid.Text;

  OracleConnection conn = new OracleConnection();  // C#                conn.ConnectionString = strConnection;
                conn.Open();

                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = "INSERT INTO BUYING_ACTIVITY (CUSTOMER_SOURCE_CODE, CUSTOMER_NAME, CUSTOMER_CITY, CUSTOMER_STATE, CUSTOMER_POSTAL_CODE, BUYING_ACTIVITY_CODE, ID) " +"VALUES (:custsrc, :name, :city, :state, :postcode, :actcode, :id)";


                cmd.Parameters.Add(new OracleParameter("custsrc", custsrc));
                cmd.Parameters.Add(new OracleParameter("name", name));
                cmd.Parameters.Add(new OracleParameter("city", city));
                cmd.Parameters.Add(new OracleParameter("state", state));
                cmd.Parameters.Add(new OracleParameter("postcode", postcode));
                cmd.Parameters.Add(new OracleParameter("actcode", actcode));
                cmd.Parameters.Add(new OracleParameter("id", id));

                cmd.ExecuteNonQuery();

                conn.Close();

Response.Redirect("contractinfo.aspx?Id=" + labelRID.Text);


I get nothing on the labelID.Text when I step thru my code and then when it goes to the next page I obviously get nothing as well contractinfo.aspx?Id="" where the "" should be the id value. How do I fix this with the code I have.

asp .net web development

$
0
0
i need to create a wesite for alumni association of my collage,please help
i wish to do it in asp .net

ASMX Web Service Soap Extension ProcessMessage function not calling

$
0
0
i have a asmx web service and i attached the Soap Extension just to intercept data and encrypt/decrypt it but the problem is Soap Extension ProcessMessage function not calling

here is my full code with web.config and i am running the code from VS2013.

please see my code and tell me where i made the mistake for which ProcessMessage function not calling
namespace EncryptASMX
{///<summary>/// Summary description for Test1///</summary>    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.// [System.Web.Script.Services.ScriptService]publicclass Test1 : System.Web.Services.WebService
    {public AuthenticateHeader Credentials;

        [AuthExtension]
        [SoapHeader("Credentials", Required = true)]
        [WebMethod]publicstring Add(int x, int y)
        {return (x + y).ToString();
        }
    }publicclass AuthenticateHeader : SoapHeader
    {publicstring UserName;publicstring Password;
    }

    [AttributeUsage(AttributeTargets.Method)]
    publicclass AuthExtensionAttribute : SoapExtensionAttribute
    {int _priority = 1;publicoverrideint Priority
        {get { return _priority; }set { _priority = value; }
        }publicoverride Type ExtensionType
        {get { returntypeof(AuthExtension); }
        }
    }publicclass AuthExtension : SoapExtension
    {publicoverridevoid ProcessMessage(SoapMessage message)
        {if (message.Stage == SoapMessageStage.AfterDeserialize)
            {//Check for an AuthHeader containing valid//credentialsforeach (SoapHeader header in message.Headers)
                {if (header is AuthenticateHeader)
                    {
                        AuthenticateHeader credentials = (AuthenticateHeader)header;if (credentials.UserName.ToLower() =="jeff"&&
                            credentials.Password.ToLower() =="imbatman")return; // Allow call to executebreak;
                    }
                }// Fail the call if we get to here. Either the header// isn't there or it contains invalid credentials.thrownew SoapException("Unauthorized",
                    SoapException.ClientFaultCode);
            }
        }publicoverrideObject GetInitializer(Type type)
        {return GetType();
        }publicoverrideObject GetInitializer(LogicalMethodInfo info,
            SoapExtensionAttribute attribute)
        {returnnull;
        }publicoverridevoid Initialize(Object initializer)
        {
        }
    }
}


web.config entry
<?xmlversion="1.0"?><!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  --><configuration><system.web><compilation debug="true" targetFramework="4.5" /><httpRuntime targetFramework="4.5" /><webServices><soapExtensionTypes><add type="EncryptASMX.AuthExtension,EncryptASMX" priority="1"  /></soapExtensionTypes></webServices></system.web></configuration>


i consult two links but still not configure how to run process message. here are the links

http://www.c-sharpcorner.com/article/using-soap-header-and-soap-extensions-in-a-web-service/

http://www.codeguru.com/csharp/csharp/cs_webservices/security/article.php/c5479/Build-Secure-Web-Services-With-SOAP-Headers-and-Extensions.htm
tbhattacharjee

ASMX: Facing problem to send user credentails from client side to service end

$
0
0
i consult these two web site just to know how to work with soap header

https://www.codeproject.com/articles/4398/authentication-for-web-services-using-soap-headers

https://www.codeproject.com/Articles/27365/Authenticate-NET-Web-Service-with-Custom-SOAP-Head

i also develop my web service this way. see the code
namespace CustomAuthWithHTTPModule
{///<summary>/// Summary description for SecureWebService///</summary>publicclass Authentication : SoapHeader
    {publicstring User;publicstring Password;
    }publicclass SecureWebService : WebService
    {public Authentication authentication;

        [WebMethod]
        [SoapHeader("authentication", Required = true)]publicstring ValidUser()
        {if (User.IsInRole("Customer"))return"User is in role customer";if (User.Identity.IsAuthenticated)return"User is a valid user";return"not authenticated";
        }

    }

}


in my console apps i create the proxy of the above web service just by add web reference. the problem is AuthHeaderValue or UserCredentialsValue both property is not being expose at client side by which i can send user credentials. see my client code
ServiceReference1.SecureWebServiceSoapClient xx = new ServiceReference1.SecureWebServiceSoapClient();

            ServiceReference1.Authentication a = new ServiceReference1.Authentication();
            a.User = "Hello";
            a.Password = "Hello";
            xx.AuthHeaderValue  or xx.UserCredentialsValue // not being expose


guide me where i made the mistake. i am working with VS2013 IDE. thanks
tbhattacharjee

ViewData, Viewbag and tempdata not working

$
0
0
Hi,

I am trying to pass data from controller to view and tried all the three options ViewData, Viewbag and tempdata but none of them are working. When I am debugging, I can see the value but it is not displaying

Here is my code snippet:
[HttpPost]
public ActionResult AllProducts(int zip)
{
ViewBag.Message = "Welcome";
ViewData["Test"] = "Welcom to Test";
TempData["Testing"] = "Welcome to Testing";
return View("AllProducts");
}

This is a @ViewBag.Message


This is a @ViewData["Test"]


This is a @TempData["Testing"]



Output:
This is a

This is a

This is a

Can someone please tell me what am I doing wrong. Thanks in advance.
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>