Namespace-using AccessDataTableAdapters; In xsd file - xs:schema id="AccessData" targetNamespace="http://tempuri.com/AccessData" AccessDataTableAdapters.pListACShippingTableAdapter adapter = new AccessDataTableAdapters.pListACShippingTableAdapter(); AccessData.pListACShippingDataTable dt;

I've built a small basic web bot app using bot framework and want to deploy it on Azure. I've followed all the steps and it's working fine under "Test in Web Chat" of Azure Portal too, but however as I open my bot's endpoint

https://optlbot.azurewebsites.net/api/messages

I get an error saying

The requested resource does not support http method 'GET'

Can somebody please help me, I can't debug my application at all. I've also tested on emulator and there too it's working fine.

I've got a ASP.NET Core 2 application running with a certain controller being an WebAPI part, where it responds to JQuery AJAX requests from the other web pages on the same application.

On the WebAPI functions that return JSON results back to the web page to show the data, I'm confused as how to secure and validate the requests that are hitting the WebAPI controller functions. I was thinking that someone from another website might call the WebAPI outside the website that it is suppose to service or call it manually using a tool and get the data out.

What is the best way to secure the WebAPI functions so that only requests coming from the web application itself is processed and other invalid/false requests are rejected? What is the best way to do this? Is there a built in technique to disable these fraudalent requests from outside the web application?

I am building an application using Asp.Net WebAPI and Angular.

We are implementing Windows Authentication on both the UI application and WebAPI.

While running the application in the browser the first time, the Windows Authentication popup is shown for. But instead of waiting until the user has authenticated, the application redirects to API url in browser.

Can anyone help me to solve the problem.

Thanks

My web site developed using asp.net 4.0 web forms which requires client certificates to access the site. implementing this we need to install each client certificate on our server, then IIS validate client certificate with stored certificates on server. but We are expecting large number of users in our site, so installing each user certificate on server is not practical. We are capturing user digital certificate and storing it into database, Is there any way to implement a custom client certificate validator? so that we can validate certificate with our database instead on installing it into server.

Requirement is to show Toast Notifications from asp.net web application.

I have a WCF service hosted in my asp.net web app, where I'll receive responses from another web service. As and when I receive the response, I need to send a toast with some info.

To support toasts on traditional asp.net application, I did add "TargetPlatformVersion" tag with "10.0" in the .csproj file and there after I could add the references of "Windows.Data" & "Windows.UI" namespaces that are required to send Toasts.

Now in my WCF service code behind, I handled the response received and at last added new API ("UpdateToast") to send toasts, where I continuously getting Argument Exception at this caller itself.

Exception detail below:

{System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

I tried adding displaying MessageBox construct in my "UpdateToast" API, and it works but once I include any WinRT API's, I get this exception.

I couldn't get any clue as whether WinRT API's are not supported here in this context or whether I did messed up anything. Kindly help.

I would like to upload a file with html form approach. It's ok with chrome, but I met error with ie. It shows "Access to the path '{path}' is denied." I am using ASP.NET and IIS, below is the code.

<form action="/ProjectAssistant/ProjectFileUpload/Upload" enctype="multipart/form-data" method="post">            
<div class="form-group">
<input type="file" name="file" accept=".xlsx,.xlsm" required="">
<br>
<label>SheetName:<input type="text" name="sheetName" value="" required=""></label>
</div>
<input type="submit" value="Upload" class="btn btn-success">
</form>

i have a drop down list that is populated by a stored proc..

It has pulled back all the data in that table, but i would only like to show a few on the list.. how is it possible to just select a couple of them via inputting the id numbers.. i have something like this at the moment but it doesnt work...

DropDownList1.DataSource = mgr.GetItemSeriesMaster();.DefaultView.RowFilter("ID = 201");

And my final question is once populated my grid view is not changing to the selected item in the list... when my aspx site refreshes the data does not change.. does anybody know how to fix this so that it changes when i select a different item..

The scenario is I have an object I'm using multiple times in a razor form, and I need to prefix the error message data attributes so that they make sense in the validation summary.

Quick example:

public class Person 
{
    [Required(ErrorMessage = "First Name is Required")]
    public string FirstName { get; set; }
}

public class User 
{
    [Required]
    public Person User { get; set; }
    [Required]
    public Person NextOfKin { get; set; }
}

If I used the User class in the form, and the FirstName was left empty in multiple locations the error messages would be identical with nothing to distinguish between the two.

What are my best options in this scenario?

Thanks.

I need your help about a syntax in C# :

here is my actual code:

<div class="class">
    <h5>MySuperTitle</h5>
    <ul>
        @if (Ms.Cs.value1 != null)
        {
            <li> My Li1 <span>@Ms.Cs.value1</span> </li>
        }
        @if (Ms.Cs.value2 != 0)
        {
            <li> My Li2 <span>@Ms.Cs.value2</span> </li>
        }
        @if (true)
        {
            <li> My Li3 <span>--</span></li>
        }
        @if (Ms.Cs.value4 != 0)
        {
            <li> My Li4 <span>@Ms.Cs.value4</span></li>
        }
        @if (Ms.Cs.value5 != null)
        {
            <li> My Li5 <span>@Ms.Cs.value5</span></li>
        }
    </ul>
</div>

What I'm looking for is to add a @if conditional on "MySuperTitle" too to hide it if there is no "sub" value.

Have i to add a @if (Ms.Cs.value1 != null) || (Ms.Cs.value2 != 0) || (Ms.Cs.value4 != 0) ..... ?

Or is there an better syntax ? Thanks a lot

I have 3 textboxes that have AutoPostBack = true. On postback it's losing it's focus. I've been searching and tried many things but nothing is working.

The code below is a snippet of what i'm trying to do.

basically this first snippet isn't grabbing anything. Does anyone know what i'm doing wrong here

**Side note I'm not using Update Panel i'm using LayoutItemNestedControlContainer

        Dim ctrl = From control In wcICausedPostBack.Parent.Controls.OfType(Of WebControl)()
                   Where control.TabIndex > indx
                   Select control






Protected Sub txtDEPTH_TextChanged(sender As Object, e As EventArgs) Handles txtDEPTH.TextChanged
    UpdateProductTemp()

    txtDEPTH.Focus()
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    If Page.IsPostBack Then
        Dim wcICausedPostBack As WebControl = CType(GetControlThatCausedPostBack(TryCast(sender, Page)), WebControl)
        Dim indx As Integer = wcICausedPostBack.TabIndex

        Dim ctrl = From control In wcICausedPostBack.Parent.Controls.OfType(Of WebControl)()
                   Where control.TabIndex > indx
                   Select control

        ctrl.DefaultIfEmpty(wcICausedPostBack).First().Focus()

    End If



End Sub

Protected Function GetControlThatCausedPostBack(ByVal page As Page) As Control
    Dim control As WebControl = Nothing
    Dim ctrlname As String = page.Request.Params.[Get]("__EVENTTARGET")

    If ctrlname IsNot Nothing AndAlso ctrlname <> String.Empty Then
        control = page.FindControl(ctrlname)
    Else

        For Each ctl As String In page.Request.Form
            Dim c As Control = page.FindControl(ctl)

            If TypeOf c Is TextBox OrElse TypeOf c Is DropDownList Then
                control = c
                Exit For
            End If
        Next
    End If

    Return control
End Function

I'm writing razor syntax for web pages. My issue is that I have a table that contains employee email-address, and I want to send them an email after clicking any of their names from the form field.

Here is what I have tried so far:

// Initialize WebMail helper
        WebMail.SmtpServer = "smtp.office365.com";
        WebMail.SmtpPort = 25;
        WebMail.UserName = "";
        WebMail.Password = "";
        WebMail.From = "";
        WebMail.EnableSsl = true;




//i want to send a message to an email
WebMail.Send(to: Email,
subject: "Visitor Alert",
body: " From: <br/> " + "Name: " + full_name + "<br/> " + " Mobile Number: " 
+ phone_number + "<br/> " + " Address :" + address);

//this is html part
<div class="form-group">
@{


var data = "SELECT FullName,Email From Employee ORDER BY Email";
var DB = Database.Open("VisitorConnectionString").Query(data);


<label>Whom to See</label>
<select class="form-control">

<option>---Select Staff---</option>
//here was to populate the name of the employees from database                                                                       
@foreach (var item in DB)
{


<option name="Email" value="@item.FullName">@item.FUllName</option>



 }


</select>
        }

I have a list of ViewModel which also contains list of other models. I am working on a pre built database which i cant change the structure. I am having difficulties displaying the ViewModel data in razor.

MyBigViewModel definition

public class MyBigViewModel
    {
        public List<FirstModel> FirstModel { get; set; }
        public List<SecondModel> SecondModel { get; set; }
        public List<ThirdModel> ThirdModel { get; set; }
        public List<FourthModel> FourthModel { get; set; }
        public List<FifthModel> FifthModel { get; set; }

    }

I have some buisness logic and based on a query(based on a single model) i will try to populate the view model.

List<MyBigViewModel> BigViewModel = new List<MyBigViewModel>();
    foreach (var SingleModel  in FirstModelList)
     {
        SecondModelResult = db.somequery;
        ThirdModelResult = db.somequery;
        FourthModelResult = db.somequery;
        FifthModelResult = db.somequery;

        MyBigViewModel TempViewModel = new MyBigViewModel{
            FirstModel  = FirstModelResult;
            SecondModel = SecondModelResult;
            ThirdModel  = ThirdModelResult;
            FourthModel = FourthModelResult;
            FifthModel  = FifthModelResult;
        }
        BigViewModel.Add(TempViewModel);

      }

The result set in BigViewModel is exactly the way i wanted it to be structured, but i am unable to display the data in razor using for each. When i try to use @foreach (var item in Model) @Html.DisplayFor(modelItem => item.FirstModel.Name) is not able to access the data i want.

I need some suggestions on how I would go about generating a Barcode Image from a number. I am using ASP.NET C# and Razor (ASP.NET Webpages)

@{
Page.Title = "Title goes here";

var ItemNameY = "";
int BarcodeOne = 0;
var sBarcode = "";
var ItemDescY = "";
var ItemQtyY = "";
var ItemPriceY = "";

if (IsPost)
{
    if (!Request["BarcodeZ"].IsEmpty())
    {
        BarcodeOne = 123456;
        sBarcode = BarcodeOne.ToString();
        // Generate Barcode Image here.
    }

}}


<html>
<body>
<form action="" method="post" enctype="multipart/form-data">
<label for="Image">Item Name :</label>
<input name="ItemNameY" type="text" size="50" value="@ItemNameY" />

<input type="submit" value="Create Barcode" name="BarcodeZ" />
</form>

<div>@sBarcode</div>
</body>
</html>

Can someone please help ? Please release from "OnHold" status.

I am building a simple web API which retrieves customers:

config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
    name: "GetGpiStatus",
    routeTemplate: "api/{controller}/{id}",
    defaults: new { id = RouteParameter.Optional }
);

And the action:

[Route("GPIWebApi/GetGpiStatus/{Reference}")]
public IEnumerable<GPI> GetGpiStatus(string Reference)
{
    var gPIs = DAL.DAL.GPIHistory_GetLatestStatus(Reference);
    return gPIs;
}

Locally it work correctly: http://localhost:60596/GPIWebApi/GetGpiStatus/gl001

But on the prodcution server it does not: http://MyHostOnServer/GPIWebApi/GetGpiStatus/gl001

im doing the Wingtip Toys sample from Microsoft and im having the following error paypal Amount Total mismatch, this is happening because i have two variables, both decimal, one of them returns 2.94 and the other returns 294.

decimal paymentAmountOnCheckout = Convert.ToDecimal(Session["payment_amt"].ToString());
decimal paymentAmoutFromPayPal = Convert.ToDecimal(decoder["AMT"].ToString());

how do i put both of them with 2.94??

I am trying to add videos in the rich editor in TinyMCE. By default Episerver removes all the html attributes. I am doing this to have the html attributes there

    [TinyMCEPluginNonVisual(
       PlugInName = "CustomValidElement",
       AlwaysEnabled = true,
       ServerSideOnly = true,
       EditorInitConfigurationOptions = "{ extended_valid_elements: 'iframe[*]' }")]
public class CustomValidElement
{
}

And in my config file

<tinyMCE mergedConfigurationProperties="valid_elements, extended_valid_elements, invalid_elements, valid_child_elements" />

It is working the only is that I have to go the source of the code and then add attribute allowFullScreen to the iframe. Is it possible that it is added by default?

TinyMCE versions is 3 Episerver version is 10.4.3.0

I am trying to pass parameter from one page to another page. I am using CrystalReportViewer on the other page.

There is CrystalReportViewer1_Init(object sender, EventArgs e) function, there I should receive the filename from the previous page

Here is my code

protected void CrystalReportViewer1_Init(object sender, EventArgs e)
{
    ReportDocument _rdStudents = new ReportDocument();

    string reportPath = Server.MapPath("~/CrystalReportFiles/Inventory/" + Request.QueryString[" filename "].ToString());
    //string reportPath = Server.MapPath("~/CrystalReportFiles/Inventory/WeightBarcorde.rpt");    This code is working
    _rdStudents.Load(reportPath);     
    CrystalReportViewer1.ReportSource = _rdStudents;
}

Here is my parameter http://localhost:55047/CrytalReportTest.aspx?filename=WeightBarcorde.rpt

<a target="_blank" href="CrytalReportTest.aspx?filename=WeightBarcorde.rpt">WeightBarcorde.rpt</a>

Can we pass parameter inside init function? or What is wrong in my code

I'm using standard Web Forms authentication and trying to make a certain part of the website restricted for regular users. When user enters /admin_panel* they should get an error like 403 or 404, but with my config user gets redirected to login page instead, even though he is already authenticated.

Piece of my config:

<location path="admin_panel">
    <system.web>
      <authorization>
        <allow roles="Admin"/>
        <deny users="*, ?" />
      </authorization>
    </system.web>
</location>

<authentication mode="Forms">
  <forms loginUrl="login"/>
</authentication>

5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message.

I have an ASP.NET web application that has a contact page with a form. It was going to well until I changed the host. For example, if I change the host to smtp.live.com instead of smtp.gmail.com I got the error that is above. My question is, if my host is from my gmail account, it works fine but if I change it, it doesn't work. I've already searched other questions but they are different from mine and can't find any suitable answer on Google.

My code is the following:

public partial class WebForm2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void btnSend_Click(object sender, EventArgs e)
    {
        MailMessage mm = new MailMessage("sender@hotmail.com", "mymail@hotmail.com");
        mm.Subject = TextBox1.Text;
        mm.Body = "Name: " + txtName.Text + "<br /><br />Email: " + txtEmail.Text + "<br />" + TextBox2.Text;

        if (FileUpload1.HasFile)
        {
            string FileName = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
            mm.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileName));
        }

        mm.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        //smtp.Host = "smtp.gmail.com";
        smtp.Host = "smtp.live.com";
        smtp.EnableSsl = true;
        System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
        NetworkCred.UserName = "mymail@hotmail.com";
        NetworkCred.Password = "xxxxxxxx";
        smtp.UseDefaultCredentials = false;
        smtp.Credentials = NetworkCred;
        smtp.Port = 587;
        smtp.Send(mm);
        lblMessage.Text = "Email Sent SucessFully.";
    }
}