I'm running ASP.NET MVC via XSP on OSX with Visual Studio for the Mac. I want my web application to write to the App_Data folder, but I don't know how to give the application or the XSP Server permission to do so. If I were running on Windows I'd give the user account, assigned to the AppPool write access. What do I do on the Mac?

I tried to create show function for main category but there is an error showing that variable categories is undefined. can help to solve it?

controller:

  public function show($id)
  {
    $categories = Categories::find($id);
    return view('Admin.categories.show',compact('maincategory'));
  }

blade:

{{ $categories->main_cate }} 

Route:

 Route::get('/admin/show/{id?}', 
 ['uses'=>'AdminCategoriesController@show','as'=>'Admin.categories.show']);

I am attempting to use imported images in my .Net Project. I have placed the images in the images folder and they all have a plus sign and say "Pending add" next to them.

I'm not sure if this is the error or how I am referencing the images. I reference the image using the following code.

<img class="block" id="u730_img" src="Images/green9-crop-u730.jpg?crc=200722682" alt="" width="1529" height="659"/>

The image name is correct, but I'm not sure if that is the appropriate path. My folder structure is below. The file being used is LoginBody.cshtml and the image is in the images folder.

enter image description here

I have the following classes defined in my project

 public class PolicyDocs
{
    [Key]
    [Required]
    [MaxLength(20)]
    public string PolicyDocID { get; set; }
    [DisplayName("Date Revised")]
    public DateTime DateRevised { get; set; }

    [MaxLength(500)]
    [DisplayName("Document Name")]
    public string DocumentName { get; set; }

    [MaxLength(10)]
    [DisplayName("Version")]
    public string VersionNo { get; set; }

    [MaxLength(255)]
    [DisplayName("Location")]
    public string DocumentPath { get; set; }

    public string CategoryID { get; set; }
    public ICollection<PolicyDocumentsCatagory> PolicyDocumentsCatagory { get; set; }
}

and

  public class PolicyDocumentsCatagory
{
    [Key]
    [MaxLength(20)]
    //[Required]
    public string CategoryID { get; set; }

    [MaxLength(20)]
    [Required]
    [DisplayName("Description")]
    public string CategoryDesc { get; set; }

    [DisplayName("Active")]
    public Boolean IsActive{ get; set; }

}

Data is properly loaded in to the table . Example:

PolicyDocs:
 1 ,"12-Jan-2017", "Document 1","version 1",100

PolicyDocumentsCategory:
 100, "Information Technology", "true".

I am using the following query in my Controller Class

 _context = new ApplicationDbContext();
        //PolicyDocs _Policy = new PolicyDocs();
        var _LPolicies = _context.PolicyDocs.Include(i=> i.PolicyDocumentsCatagory).ToList();
        return PartialView("_GetAllPolicies", _LPolicies);

While running the query I am unable to see any data loaded for PolicyDocumentsCategory in "_LPolicies" object. The query is loading data in table "PolicyDocs".

Nor I am able to reference the PolicyDocumentsCategory in VIEW. I can not see the properties of "PolicyDocumentsCatagory" in the view

    @model  IEnumerable< MyRTOCloud.DBModels.PolicyDocs>
<div class="row">
    <div>
        <table id="Categories" class="table table-hover">
            <thead>
                <th>Category</th>
                <th>Document Name</th>
                <th>Release Date</th>
                <th>Version</th>
            </thead>
            @foreach (var lp in Model)
            {
            <tr>
                <td>@lp.PolicyDocumentsCatagory.____</td> // I can not see any peroprty of "PolicyDocumentsCatagory"

                <td>@lp.DocumentName </td>
                <td>@lp.DateRevised </td>
                <td>@lp.VersionNo </td>
            </tr>
            }
        </table>
    </div>
</div>

Thanks,

 $(".category-sub-opition-list li").click(function () {
        var id = $(this).attr("id");
        var category = getUrlParameter('category');
        @{
            var category = Request.QueryString["category"];
            var cat = Model.Items.Where(i => i.Id.ToString() == category).FirstOrDefault();
            if(cat==null)
            {
                Code to Redirec to page
            }
        }
    });

in JQuery I want to check Model list, whether the option is available in List or not, If category does not exists in list, I want to redirect page.

my question is how i can send single data from controller to a view without viewbag ,viewdata,with linq ? ,and write it in view ,like this @Html.DisplayFor(it => item.something) i wrote it with foreach ,i tryed with Html.DisplayNamefor but it didnot worked ,thanks alot .

I have a question, i'm working with ASP.NET MVC, i want to remove Index action from the URL using routes.

To give more details: I Have contacts model, i'm showing the details of each contact in the Index page using the ID, "let's say Index now works as Details page", ex : contact 5 https://localhost:44339/Contacts/Index/5

What i want is to remove the Index action from the URL, especially the Index action, so the URL become : https://localhost:44339/Contacts/5

i have only this route for now :

            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");

Below how i access the contact :

<a asp-controller="Contacts" asp-action="Index" asp-route id="@c.Id">@Html.DisplayFor(modelItem => c.Name)</a>

I did many searches to get a solution, but nothing helped.

Thanks in advance.

I have created a simple Entity Framework project in which i'm fetching the records from database by creating :-

  1. A database from sql server

  2. A Model class Employee.cs

  3. A data context class EmployeeDbContext.cs:

  4. 'connectionString' to fetch the table values from the database.

  5. A Scaffolded DemoController.cs with read/write actions and views using Entity Framework.

Everything is working correctly but now is it possible to make EmployeeId values as a editable Hyperlink so that if at the run time if i will double click on it, i will get the particular individual data where i can edit the records and when i will click on the save button i want to redirect at Index of the main scaffolded controller with the updated values. If anyone can help me with the easy and meaningful suggestion. Thanks in advance.

I am creating a Health App that will take the Identity, Symptom, Disease and Treatment of the patient.

I have created models: Identity, Symptom, Disease, Treatment. I am using form.ModelForm so that I can save the data to the db i.e. sqlite3.

I have created class based views that will handle forms, take field values, sanitize the data, and render the required form and values.

Problem: Each time I attempt to save values for the Symptom form it seems to save it, and redirect to a new form but I am not seeing it in the Admin Backend.

Code:

Model document

from django.db import models
from django.utils import timezone
import datetime

class Identity(models.Model):

    NIS =models.CharField(max_length = 200, primary_key = True)
    timestamp = models.DateTimeField(auto_now = True)
    first_name = models.CharField(max_length = 80, null = True)
    last_name = models.CharField(max_length = 80, null = True )
    contact = models.CharField(max_length = 15, null = True)
    location  = models.CharField(max_length = 100, blank = True)
    birthday= models.DateField(auto_now = False, auto_now_add = False, blank = True, null = True)

    def __str__(self):
        return '%s, %s' % (self.first_name ,self.last_name)

class Symptom(models.Model):

    condition_name = models.CharField(max_length = 80, default = '')
    description = models.TextField(max_length = 1000, default = '')

    def __str__(self):
        return self.condition_name

class Disease(models.Model):

    disease_name = models.CharField(max_length = 80, default = '')
    description = models.TextField(max_length = 1000, default = '')

    def __str__(self):
        return self.disease_name

class Treatment(models.Model):

    term = models.CharField(max_length = 80, default = '')
    treatment = models.TextField()
    patient = models.ManyToManyField(Identity, through = 'Consultation')
    date_done = models.DateField(auto_now = False, auto_now_add = False, blank = True, null = True)

    def __str__(self):
        return self.Term


class Consultation(models.Model):

    patient_identity = models.ForeignKey(Identity)
    patient_condition = models.ForeignKey(Symptom)
    patient_disease = models.ForeignKey(Disease)
    patient_treatment = models.ForeignKey(Treatment)
    date_seen = models.DateField(auto_now = False, auto_now_add = False, blank = True, null = True)

    def __str__(self):
        return '%s' %(self.patient_identity)

Views document

from django.shortcuts import render, redirect
from django.views.generic import CreateView, ListView, DetailView, FormView, TemplateView
from patient.models import Identity, Symptom, Treatment, Disease, Consultation
from patient.forms import IdentityScript, SymptomScript


class Identity_view(CreateView):


    model = Identity

    template_name = 'patient/script.html'


    def get(self, request):

        form = IdentityScript()

        script = Identity.objects.all()

        var = {'form':form, 'script':script}

        return render(request, self.template_name, var)

    def post(self, request):

        form = IdentityScript(request.POST)


        being = None

        if form.is_valid():

            NIS = form.save(commit = False)

            NIS.user = request.user


            NIS.save()


            being = form.cleaned_data['first_name']


            form = IdentityScript()



            return redirect('script:script')

        var = {'form':form, 'being':being}

        return render(request, self.template_name, var)

class Identity_list_view(ListView):

    model = Identity

    template_name = 'patient/Identity_list.html'

    def get(self, request):

        form = IdentityScript()

        script = Identity.objects.all().order_by('-Timestamp')

        var = {'form':form, 'script':script}

        return render(request, self.template_name, var)




class Medical_document(CreateView):

    model = Symptom

    template_name = 'patient/medical_document.html'

    def get(self, request, pk):

        form = SymptomScript()

        expression = Symptom.objects.all()

        var = {'form':form, 'expression':expression, 'pk':pk}

        return render(request, self.template_name, var)

    def post(self, request, pk):

        form = SymptomScript()

        state = None

        if form.is_valid():

            manuscript = form.save(commit = False)
            manuscript.user = request.user
            state = form.cleaned_data['description']
            manuscript.save()

            patient = Identity.objects.get(pk=pk)

            form = SymptomScript()

            redirect('script:script')


        else:
            print(form)

        var = {'form': form, 'state':state, 'pk':pk}

        return render(request, self.template_name, var)

Forms document

from django import forms
from patient.models import Identity, Symptom, Disease

class IdentityScript(forms.ModelForm):

    NIS = forms.CharField(

        widget = forms.TextInput(

                attrs = {

                        'placeholder': 'Enter NIS',
                                'class' : 'form-control'
                }
        )
    )


    first_name = forms.CharField(
            widget = forms.TextInput(

                    attrs = {

                            'placeholder': 'Enter First Name',
                            'class' : 'form-control'
                    }
            )
    )



    last_name = forms.CharField(
            widget = forms.TextInput(

                    attrs = {

                              'placeholder': 'Enter Last Name',
                             'class' : 'form-control'
                    }
            )
    )

    contact = forms.CharField(
        widget = forms.TextInput(

                attrs = {

                        'placeholder':'Enter Contact',
                                'class':'form-control'
                }
        )
    )

    born = forms.DateField(

            widget = forms.TextInput(
                    attrs = {

                        'placeholder' : 'Enter Birth',
                            'class':'form-control'

                    }
            )
    )

    location = forms.CharField(
        widget = forms.TextInput(

                attrs = {

                        'placeholder':'Enter location',
                                'class':'form-control'
                }
        )
    )


    class Meta:

        model = Identity

        fields = ('NIS', 'first_name', 'last_name', 'birthday', 'location', 'contact', )




class DiseaseScript(forms.ModelForm):

    disease_name = forms.CharField(

        widget = forms.TextInput(

                attrs = {

                        'placeholder': 'Enter Disease Name',
                                'class' : 'form-control'
                }
        )
    )

    description = forms.CharField(

        widget = forms.TextInput(

                attrs = {

                        'placeholder': 'Enter description',
                                'class' : 'form-control'
                }
        )
    )



    class Meta:

        model = Disease

        fields = ('disease_name', 'description')


# Create SymptomScript form

class SymptomScript(forms.ModelForm):

    condition_name = forms.CharField(

        widget = forms.TextInput(

                attrs = {

                        'placeholder': 'Enter Condition Name',
                                'class' : 'form-control'
                }
        )
    )

    description = forms.CharField(

        widget = forms.Textarea(

                attrs = {

                        'placeholder': 'Enter Description',
                                'class' : 'form-control'
                }
        )
    )

    class Meta:

        model = Symptom

        fields = ('condition_name', 'description')

I'm working on some response-caching middleware for ASP.NET. One of its features is to invalidate cache of certain action when specific action is executed.

Sparing you the details of how the cache-key logic is implemented, I'll go straight to the question.

Here is a controller with two actions:

public class EchoController : ApiController
{
    [HttpGet]
    [Route("api/echo/{userId}/{message}")]
    public async Task<IHttpActionResult> Echo(
        [AttributeX] string userId,
        [AttributeX] string message,
        string queryString)
    {
        await Task.Delay(150);
        return Ok(new {Action = "Echo", UserId = userId, Message = message, QueryString = queryString});
    }

    [HttpPost]
    [Route("api/echo/dosomething")]
    [AttributeY(ActionName = "Echo")]
    public async Task<IHttpActionResult> DoSomethingWithAction(string userId, string message)
    {
        await Task.Delay(150);
        return Ok();
    }
}

AttributeY is an ActionFilterAttribute and implements the OnActionExecuting(HttpActionContext actionContext) method.

In this implementation I would like to have a list of all action parameters of action Echo filtering only those with the AttributeX attribute.

How could I do that?

  • Reminding you that whenever action DoSomethingWithAction is called, then OnActionExecuting is called with context containing information about DoSomethingWithAction action, not Echo action.

I am developing an ASP.net web app which uses Facebook authentication. The Facebook login feature was working correctly in August, but I had to take a few months off from the developing this app because of personal reasons. But now, when I try to login to the app with Facebook, I get this error message:

"URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs."

I haven't changed any code from my app since September or August, so something must have changed in the way Facebook processes its logins.

I have made changes to the Facebook app settings to try and fix this but nothing works.

My current settings look like this:

Client OAuth Login: Yes

Web OAuth Login: Yes

All the other settings under the Facebook Login product are set to No.

My current redirect URIs look like this:

https://myapp.azurewebsites.net/api/ExternalLogin/Facebook
https://myapp.azurewebsites.net/api/ExternalLogin/FacebookCallback
https://myapp.azurewebsites.net/api/signin-facebook
https://myapp.azurewebsites.net/api/ExternalLogin/Facebook/signin-facebook

Originally I only had the "/FacebookCallback" URI. I only added the others following suggestions from other questions here on Stack-overflow, but I am still getting the same error message. What am I missing? How often does Facebook change how their API works?

This question already has an answer here:

i am trying to learn Asp.Net MVC and i am following a video tutorial, the problem is i am doing the same thing with tutor, but my code does not work properly, i am trying to create a blog post, everything works fine but it does not upload an image to folder specified and does not insert file path to sql. there is create.cshtml and AdminPostController.cs.

the codes inside the create.cshtml like;

@model MvcBlog.Models.Post

@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<h2>Create Post</h2>

@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()

<div class="form-horizontal">
    <h4>Post</h4>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })

 <div class="form-group">
        @Html.LabelFor(model => model.Photo, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
        <input type="file" name="Photo" id="Photo" accept=".jpg,.png,.gif,.JPEG,.jpeg,.JPG" class="form-control" />
            @Html.ValidationMessageFor(model => model.Photo, "", new { @class = "text-danger" })
        </div>
    </div>

</div>

And AdminPostController.cs like;

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using MvcBlog.Models;

namespace MvcBlog.Controllers
{
    public class AdminPostController : Controller
    {
        blogDB db = new blogDB();




        [HttpPost]

        public ActionResult Create(Post post, string tags,HttpPostedFileBase Photo) 
        {
            if (ModelState.IsValid)
            {
                if (Photo != null)
                {
                    WebImage img = new WebImage(Photo.InputStream);
                    FileInfo photoinfo = new FileInfo(Photo.FileName);

                    string newphoto = Guid.NewGuid().ToString() + photoinfo.Extension;
                    img.Resize(800, 350);
                    img.Save("~/Uploads/PostPhoto/" + newphoto);
                    post.Photo = "/Uploads/PostPhoto/" + newphoto;



                }
                if (tags != null)
                {
                    string[] tagsarray = tags.Split(',');
                    foreach (var i in tagsarray)
                    {
                        var newtag = new Tag { TagName = i };
                        db.Tags.Add(newtag);
                        post.Tags.Add(newtag);
                    }
                }

                db.Posts.Add(post);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
                // TODO: Add insert logic here


                return View(post);

        }

    }
}

i am very beginner, i may not understand what you talking about, so if you be precise that would be great for me, thanks in advance.

I am adding some data in List of Tuple type like this in Razor view

   List<Tuple<int, int, string>> Downloadlist = new List<Tuple<int, int, string>>();

And adding items to this list

         Downloadlist.Add(new Tuple<int, int, string>(11, 7, "somedata"));

Now I would like to access the array of data in javascript

<script>

    var listofdownloadpages = '@ViewData["DownloadPages"]';
    if (listofdownloadpages != null) {

        alert(listofdownloadpages.length);

        for (var i = 0; i < listofdownloadpages.length; i++) {
            alert(listofdownloadpages[i].wishid + ' ' + listofdownloadpages[i].remain);
        }
    }
    else {
        alert("not found anything");

    }

But this not giving me the items in correct way please help.

Is it possible to have a parameter in the middle of the URL for a Razor Page?

Example:

File Structure:

  • /products/Index <--- Shows the list of products
  • /Products/Product/Index <-- Product Page
  • /Products/Product/Page1
  • /Products/Product/Page2
  • /Products/Product/ListOfAccessories/Index
  • /Products/Product/ListOfAccessories/Details

I can create the route for the products list, but can't figure out the parameter in the middle of the URL using options.Conventions.AddPageRoute

Thanks

How to implement validate Google RECaptcha version 2.0 on Client Side using JavaScript and jQuery in ASP.Net? The Google RECaptcha version 2.0 allows to validate the Captcha response on client side using its Callback functions.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var onloadCallback = function () {
    grecaptcha.render('dvCaptcha', {
        'sitekey': '<%=ReCaptcha_Key %>',
        'callback': function (response) {
            $.ajax({
                type: "POST",
                url: "Default.aspx/VerifyCaptcha",
                data: "{response: '" + response + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (r) {
                    var captchaResponse = jQuery.parseJSON(r.d);
                    if (captchaResponse.success) {
                        $("[id*=txtCaptcha]").val(captchaResponse.success);
                        $("[id*=rfvCaptcha]").hide();
                    } else {
                        $("[id*=txtCaptcha]").val("");
                        $("[id*=rfvCaptcha]").show();
                        var error = captchaResponse["error-codes"][0];
                        $("[id*=rfvCaptcha]").html("RECaptcha error. " + error);
                    }
                }
            });
        }
    });
};
</script>

In VS2015 and earlier, when you started debugging a web application or site, it opened IE (or edge) or even chrome to view and test your project. When you closed the browser, the debugger would stop and when you stopped debugging the browser would close. In VS2017, this behavior does not happen. I find myself leaving tons of browser windows open all over the place. I would much prefer if it would simply behave as it did in VS2015 and clean up after itself.

I am sure there is a reason for this but I cannot fathom it. Is there a way to get this behavior in VS2017?

I'm still learning GWT, yet already have to face some kind of challenge for a work I have to do. Can't show any specific code so I'll try to explain it well.

Here's the situation: A certain class "Navigator" creates and save the Presenter instances of my architecture to allow reusing them. There is a method "show()" inside that same class that actually displays the view related but that system only works full screen by calling RootPanel.get().

What i'd like to do is showing that presenter instance's view inside of a flex panel element declared in a class myView (related to a class myPresenter) that basically uses Flex Panel to structure it's content.

To make it maybe more clear:

class myView{ ...

flexPanel.setWidget(firstWIdget)
flexPanel.setWidget(secondWidget) //secondWidget to be replaced by a "thirdWidget"

... } I'd like the secondWidget to be replaced by another one, let's call it thirdWidget, that consists of a specific presenter instance's view.

To resume, I'd like my presenter instance's view to not go full screen but only occupy a certain area of the screen.

The displaying is managed almost entirely programmatically, means very limited use of css files and no use at all of xml ui files.

How can I manage this ?

Thanks

Dear I have installed Twitter.Typeahead version 0.11.1. it is not working. Here is my Code

<div class="form-group" style="display:none" id="serialNumber">
                                            <div class="tt-container">
                                                <label>Serial Number</label>
                                                <input class="typeahead form-control" id="SerialNumber" name="SerialNumber" type="text" value="" placeholder="Enter Serial Number Here.." />
                                            </div>                                                                          
                                        </div>
                                        <ul id="lstSerials" class="list-group"></ul>

And bellow is my script

var sno = [];
        var serials = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('serialNumbers'),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            remote: {
                url: '/Sales/GetSerialNo?query=%QUERY',
                wildcard: '%QUERY'
            }
        });

        $('#SerialNumber').typeahead({ 
            minLength: 3,
            highlight: true,
            hint: true
        }, {
            name: 'serials',
            display: 'serialNumbers',
            source: serials
        }).on("typeahead:select", function (e, data) {
            $("#lstSerials").append("<li class='list-group-item'>" + data + "</li>");
            $("#SerialNumber").typeahead("val", "");
            sno.push(data);
        });

Here is Styling for typeahead

.twitter-typeahead .tt-query, .twitter-typeahead .tt-hint {
    margin-bottom: 0; }

.tt-hint {
    display: block;
    width: 100%;
    height: 38px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.428571429;
    color: #999;
    vertical-align: middle;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
    transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; }

.tt-menu {
    min-width: 160px;
    margin-top: 2px;
    padding: 5px;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    background-clip: padding-box; }

.tt-suggestion {
    display: block;
    padding: 3px 20px;
    width: 100%; }

.tt-suggestion.tt-selectable {
    margin: 5px 0px 5px 0px; }

.tt-suggestion.tt-cursor {
    color: #fff;
    background-color: #428bca; }

.tt-suggestion.tt-cursor a {
    color: #fff; }

.tt-suggestion p {
    margin: 0; }

Finally here is the controller, for testing purpose I have a static data

 public JsonResult GetSerialNo(string query)
        {
            List<string> lstTest = new List<string>();
            lstTest.Add("aaaHafiz");
            lstTest.Add("aaaSiddiq");
            lstTest.Add("aaaUmer");
            return Json(new { serialNumbers = lstTest }, JsonRequestBehavior.AllowGet);
        }

But when I run the application after writing three words i get only one value which is invisible don't know why.. the inspection also shows no errors. sample output errors are given in these pictures:

(.js)

$.ajax({ type: "POST", //contentType : "application/json", dataType : "json", url: "getStateNames", //url:"http://localhost:8081/Mining_22_11_17/pages/admin/a.jsp", cache: false,
data: "region=" + re + "& stId=" + state_id, success: function(response){ //$('#result').html(""); alert("hiiii state list"); var obj = JSON.parse(response); alert("state list" + obj); //$('#result').html("First Name:- " + obj.firstName +"Last Name:- " + obj.lastName + "Email:- " + obj.email); }, error: function(){
alert('Error while request..'); } });

Spring MVC Controller

@RequestMapping(value="/getStateNames",method = RequestMethod.POST) public @ResponseBody RegionDistrict add(HttpServletRequest request, HttpServletResponse response,@RequestParam String region, @RequestParam String stId) { System.out.println("Get state"); }

By running this program I am getting 404 error.I want to send request using POST only. enter image description here

I have 3 textboxes in my app. the 3rd one is for date of birth which user can keep empty.

The app saves the values entered by the user into MSSQL database that have a table with 3 culomns. the birthday culomn Data type is set to "Date" and it is set as Nullable.

If the user keeps the birthday textbox empty I want to assign NULL into the birthday column, so I tryed this code:

If txtBirthday.Text = "" Then
    command.Parameters.AddWithValue("@Field3", DBNull.value)
End If

But did'nt work. I also tryed (after adding "Imports System.Data.SqlTypes"):

If txtBirthday.Text = "" Then
   command.Parameters.AddWithValue("@Field3", SqlDateTime.Null)
End If

But also did'nt work.
I looked for a solution for the problem, but no success.

Please Help

How can i add a - character in the URL using ASP.NET MVC. I have a controller called home and action name DownloadSpiderman2PCGAMEHighlyCompressed, From the mentioned action the created URL is

http://localhost:7500/Home/DownloadSpiderman2PCGAMEHighlyCompressed

I want to add - character in to my URL i have try multiple ways couldn't find solution

My effort

I have rename the - in the view however the url does not reflect the - in the address.

 public ActionResult DownloadSpiderman2PCGAMEHighlyCompressed()
        {
            return View("Download-Spiderman2-PC-GAME-Highly-Compressed");
        }

My expected output should be

http://localhost:7500/Home/Download-Spiderman2-PC-GAME-HighlyCompressed